instantpage / instant.page

Make your site’s pages instant in 1 minute and improve your conversion rate by 1%
https://instant.page
MIT License
6.01k stars 206 forks source link

Don't do speculative loading on Incognito/Private window #130

Open isaumya opened 3 months ago

isaumya commented 3 months ago

Recently I got to play with your newly updated script with Speculative Loading added to it. It's amazing but here are a few gotcha's that I faced, so I'm sharing them here (maybe you will fix some and add some to the documentation):

  1. Speculative loading doesn't work on the Incognito/Private window. If you check under "Application Tab" in your dev tools then you will see: The prefetch was not performed because the browser is in Incognito or Guest mode. I really wish there was a way/function to check if the user is using incognito mode and if so use the fallback link mechanism otherwise use Speculative loading. Unfortunately, as much as I have tried I couldn't come up with a single function to check if the user is using incognito mode.
  2. Another thing to keep in mind (maybe good for documentation), is if you have an ad blocker extension installed like uBlock or something then speculative loading will not work as these extensions disable speculative loading.

I truly hope you get a way to figure out if the user is using incognito mode and if so, don't do speculative loading.

domenic commented 2 months ago
  1. Speculative loading doesn't work on the Incognito/Private window.

We're working on fixing this in Chromium :). https://issues.chromium.org/issues/339223835

2. Another thing to keep in mind (maybe good for documentation), is if you have an ad blocker extension installed like uBlock or something then speculative loading will not work as these extensions disable speculative loading.

This is harder to fix, but this issue discusses some first steps we're considering taking on Chromium side toward maybe, eventually resolving this. https://issues.chromium.org/issues/335328446

isaumya commented 2 months ago

Hi @domenic, Thanks for the response and great to see that both of these issues are being worked on. The prefetch not working in incognito is a major one. As many people use incognito/private mode to browser web pages, I think the speculation rule of the same origin should be allowed whether using prefetch or prerender.

For the adblocker issue, I'm optimistic that some middle ground can be found but not fully sure.

jeremyroman commented 1 week ago

Since Chrome 126.0.6478.0 (which has now been in the stable channel for some time), speculation rules prefetching in incognito contexts should work.