question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

preconnect to iframes if applicable

See original GitHub issue

Since stumptown-renderer is stateless and relatively dumb our best bet is to use meta tags for sending pre-fetching type of hints.

When rendering a page that will have <iframe src="https://someotherdomain/... in it, we should inject something like <link rel="preconnect" href="https://someotherdomain/... in the HTML.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
peterbecommented, Aug 28, 2019

In my quickly whipped up pseudo code I wrote:

image_filename = make_image_filename(interactive_example.url)
# image_filename would now be something like "ab/123/de9abac012.png"
# which might be based on an MD5 of the URL or something. 

Perhaps we can download the content of the iframe and hope that it the content of the referenced external URLs haven’t changed. E.g. in Python:

import hashlib
import requests

def make_image_filename(url):
    hash_ = hashlib.md5()
    hash_.update(requests.get(url).content)
    hash_.update(url)
    sha = hash_.hexdigest()
    return f"v1-{sha[0]}/{sha[1:]}.png"

I need to familiarize myself more with the interactive-example project and what tools are available. If we had a cron job or a webhook or something fancy we can invalidate images based on git commits.

1reaction
peterbecommented, Aug 23, 2019

wouldn’t hurt to add them, but it doesn’t seem to be helping much either

Then let’s not bother. For the benefit of hacking on other cooler things. But let’s not close the issue just yet. Mind you, sometime soon I hope we can turn PRs into fully deployed subdomains. Then we can make one production site with and one without and then it’s be easier to measure.

Read more comments on GitHub >

github_iconTop Results From Across the Web

preconnect to iframes if applicable · Issue #88 · mdn/yari
I think the idea is that the browser is first confronted with the HTML document from that first HTTP connection. It then starts...
Read more >
Using preconnect resource hint from the main window to ...
I know that if I will prefetch these scripts from the main window - the iframe will need to reload these sources (as...
Read more >
Establish network connections early to improve perceived ...
Using dns-prefetch and preconnect allows sites to reduce the amount of time it takes to connect to another origin. The ultimate aim is...
Read more >
How to Speed Up YouTube/Vimeo Embeds in WordPress
If you're using WP Rocket, go to 'Media' settings and turn on “Enable for iframe and videos” and “Replace YouTube iframe with preview...
Read more >
Securing an iframe thanks to the sandbox attribute
The sandbox attribute protects your website from iframes that could integrate malicious content. What is the sandbox attribute?
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found