Questions tagged [preconnect]
16 questions
11
votes
0 answers
Can I use a link tag to preconnect to a WebSocket destination?
I have a website that uses WebSockets to connect to the server and transfer data.
At css-tricks.com, they showed the following example for using HTML link tag preconnect:
Can I use this to…
user12537794
8
votes
4 answers
Is there a limit to how many domains we should "dns-prefetch preconnect" with Chrome?
When we want to make sure a blazing fast website who uses third-party widgets/plugins/add-ons/analytics etc.. One of the many requirements to achieve this is to "dns-prefetch preconnect" for each individual domain name (basically saving a little for…

dankilev
- 720
- 2
- 10
- 32
4
votes
1 answer
Why is preconnect resource hint not working?
I've created a test page at crenshaw.dev/demo/hints.html with browser hints requesting a dns-prefetch and preconnect to mac9416.com.
Test resource hints

crenshaw-dev
- 7,504
- 3
- 45
- 81
3
votes
1 answer
Dynamically adding a with rel=preconnect using JavaScript - does it work?
Context: The user can click a button to open a gallery of images. The images are hosted on a different domain. The vast majority of users do not open the gallery. But if a user takes a certain "trigger" action, they're much more likely to open the…

joe
- 3,752
- 1
- 32
- 41
3
votes
1 answer
dns-prefetch + preconnect vs. browser cache
To improve the page load time I want to use dns-prefetch and preconnect for external javascripts.
What happen if the ressource (in my case the…

Sr. Schneider
- 647
- 10
- 20
3
votes
0 answers
DNS-prefetch and preconnect: Only for non-cached resources?
This is a question about dns-prefetch and preconnect, and possible optimizations:
If a resource is cached, are dns-prefetch and preconnect still doing their job?
If not, is it possible to optimize this behavior so that dns-prefetch and preconnect…

Evgeniy
- 2,337
- 2
- 28
- 68
2
votes
1 answer
Is it possible to use preconnect and preload rel attributes together?
Imagine you have a web server that serves up a document and a cdn that serves up all the document's js component chunks:
There is 1 important chunk main.js that has a preload link rel.
Question: Is it possible to have a preconnect and preload rel on…

Matthew Harwood
- 39
- 6
1
vote
0 answers
Chrome's netlogs shwoing "is_preconnect=false" for resource request even after using "preconnect" resource hint for that resource
I am using the "preconnect" resource hints in my site for the font's api as
However when i am checking waterfall analysis in chrome devtools, the DNS lookup and SSL connections…

Abhishek Singh
- 101
- 6
1
vote
1 answer
Prefetch works but throws an "uncaught (in promise) error"
I am trying to use the prefetch directive with my fonts as advised by Chrome Lighthouse audit report. However, doing so is throwing the following error:
Uncaught (in promise) Error: 3000ms timeout exceeded
My stack involves NextJS for SSR. My…

TheLearner
- 2,813
- 5
- 46
- 94
1
vote
1 answer
.NET changing crossorigin/> to crossorigin=""/>
I'm trying to preconnect to resources on my .aspx page.
My code:
Which .NET turns into
I've upgraded to…

MattHodson
- 736
- 7
- 22
1
vote
2 answers
Preconnect html vs header: Which is faster?
Preconnect can be done using the http header:
or via the html:
Is there a speed advantage in using the header as the response is made available before the response content is…

DD.
- 21,498
- 52
- 157
- 246
0
votes
0 answers
Using preconnect in Chrome in advance of injected Script
I am trying to use a preconnect link (or a dns-prefetch link) to get Chrome to perform DNS resolution and ideally open the connection to the remote server. From the network timeline this does not seem to be working. I did confirm this works on…

Alex Rothberg
- 10,243
- 13
- 60
- 120
0
votes
0 answers
nginx - add header on html document only
Goal:
Configure nginx to add a header only on html document without .html extension
Prerequisite:
Add a .html to documents is not possible (they are dynamically generated by another tool via proxy_pass) and they can't be served with .html
What I…

mirage59
- 1
0
votes
1 answer
Is there any benefit in using or for resources on the same domain as the original page?
I've been reading up on performance benefits of using and to help fetch critical resources but one thing I can't quite figure out is whether these techniques still offer benefit when the resource is located on the same domain as the page that's…

Kita
- 1,548
- 14
- 21
0
votes
0 answers
PageSpeed Insights tells me to preconnect third-party origins and then tells me they are not used by the browser after preconnecting
I ran PageSpeed Insights and it told me this
Preconnect to required origins
Consider adding `preconnect` or `dns-prefetch` resource hints to establish early connections to important third-party origins. Learn more.
URL
Potential…

Sam
- 1,765
- 11
- 82
- 176