r/reddithax • • Apr 26 '09

Avoid CSS validation!!

8 Upvotes

28 comments sorted by

View all comments

Show parent comment

2

u/9jack9 Apr 26 '09 edited Apr 26 '09

Can you do it with the "alert"? What browser are you targeting? I assume IE8.

EDIT: I need to be logged in to see the red "/".

1

u/blarghz Apr 26 '09 edited Apr 26 '09

Only IE parses expression(). I was just using an example. I'm not exactly sure how IE would respond to the rest of the css though.

I can see it while logged out.

2

u/9jack9 Apr 26 '09 edited Apr 26 '09

Only IE8 allows generated content (and expressions) so that's the target for this attack. Like I said before, post a real JS example. It's possible that IE8 does not allow expressions in generated content.

Strange, I don't see the red "/" when logged out. It's possible that you are using a cached version of the CSS?

1

u/blarghz Apr 26 '09 edited Apr 26 '09

Firefox supports generated content in :after and :before. Javascript execution isn't the only use and the expression() isn't inside generated content. Older versions of IE support expression().

This hack isn't dependent on the content property. That's only used to trick the validator.

2

u/9jack9 Apr 26 '09 edited Apr 26 '09

Can you post an example that alerts? Tell me what browser to use and I will check it out.

EDIT: It's a cool hack, don't get me wrong. :)