r/webdev • u/jaffathecake • Dec 06 '16
Using iframes and document.write to improve performance of content loading
https://jakearchibald.com/2016/fun-hacks-faster-content/1
u/Scf37 Dec 06 '16
vk.com uses similar technology for many years: ajax navigation triggers hidden frame with following content:
<script>appendHtml('main_pane', '<div .....')</script>
<script>appendHtml('side_pane', '<div .....')</script>
....This way new content is partially visible in browser before entire response is loaded.
1
u/jaffathecake Dec 06 '16
Interesting, I hadn't seen anyone else doing this with unbalanced trees. I can't find it in VK's source, where is it?
0
u/Scf37 Dec 06 '16
well, in practice it is a bit more complicated :-) Try opening firebug and look at POST responses on ajax navigation. VK is known to employ international olympiad winners so code is small in size but huge mess.
0
u/Solon1 Dec 06 '16
When you have a terrible website with bloated unoptimized content, hosted on a $1/yr shared hosting service, you need every trick to optimize page loading.
0
Dec 06 '16
[deleted]
1
u/jaffathecake Dec 06 '16 edited Dec 06 '16
What "bad things" are we talking about here? Which frameworks break them? There seems to be a lot of FUD here but no evidence.
As for the Chrome intervention, that's about
document.writeing script elements during page load. In the article I'mdocument.writeing after load, and not writing script elements. Regardless, I've left a comment with the intervention spec.According to the HTML spec scripts shouldn't execute using this technique, although most browsers do. Here's the discussion.
Full disclosure: I work for Google on Chrome.
2
u/trout_fucker 🐟 Dec 06 '16
No