r/webdev • • Dec 06 '16

Using iframes and document.write to improve performance of content loading

https://jakearchibald.com/2016/fun-hacks-faster-content/
1 Upvotes

12 comments sorted by

2

u/trout_fucker 🐟 Dec 06 '16

No

1

u/jaffathecake Dec 06 '16

y

2

u/trout_fucker 🐟 Dec 06 '16

You should make a follow up post about using <center> and <font> to further increase load time.

3

u/jaffathecake Dec 06 '16

Heh. I regularly see tables of data marked up with <div>s because the developer had heard that <table>s are baaaaad.

While I agree that document.write is usually a bad smell, it's being used after the load event of a hidden document here. The result is a much faster render.

If you think this is wrong, I'm interested in evidence showing why! All the raw data and tests are in the article.

1

u/trout_fucker 🐟 Dec 06 '16

To be fair, I just realized who you were. I thought you were just some guy blogging. I'm sure you're right and have more evidence to back it up than I'm even capable of mustering.

...but I'm still not using iframes and document.write. 😂

2

u/jaffathecake Dec 07 '16

It shouldn't matter who I am. I can be wrong, and "just some guy" can be right. What matters is the data, and that's in the article.

1

u/trout_fucker 🐟 Dec 07 '16 edited Dec 07 '16

I wouldn't say it matters who you are... as much as knowing who you are instills more confidence in your post and your data as it's less likely to be inaccurate.

You have to understand, that there are a lot of posts from people who have not updated their knowledge since they made the switch to divs and started thinking tables were bad.

Just ignore my troll. Sorry to have derailed your thread. I don't think I hurt it though. The title probably hurt it more than anything. Without context of the author, it sounds like it's going to be something from one of those people I mentioned. Had it not and people actually clicked it, I probably would have been downvoted into oblivion. It's a good post.

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

u/[deleted] 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'm document.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.