When it comes to web pages I’m a bit of a speed freak. I’m constantly on the lookout for new techniques to make my pages faster. So it’s a great pleasure that I can now say that I came up with a new* technique to speed up page rendering.
The second concept proved to be more promising. I started researching if it is possible to access raw CSS files (that are loaded normally by the browser) and extract JS that way (thus avoiding AJAX), but sadly this isn’t possible. So I figured I might sneak JS code as a value of a CSS attribute. That proved possible and I used the `content` attribute which can accept arbitrary data. So once the CSS get’s loaded I read the value of `content` and inject JS code into the page. The next step was base64 encoding the JS code to avoid problems with quotes.
So the concept works but I still have a lot of work to do. Right now I’ve only tested this with Chrome. Once I test other browsers and make some benchmarks I’ll create a generic solution that anybody could use.
* I looked on the internet and haven’t found anything like this, but it is possible that my google-fu sucks and somebody else totally did this already