Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I am curious how @annnd detects whether link prefetching is supported by a browser in js on-the-fly (reliably and in a performant way) http://caniuse.com/#feat=link-rel-prefetch. There are many capabilities you can quickly detect, but for that one I can't think of a performant way. Test your solution with Safari on a Mac, which should return false.


I haven't tried detecting whether link prefetching is supported by a browser yet. Not that I think it should even be detected, because those are hints to the browser. If you need to depend on them there is something else wrong with the way you design your apps.

But if you still insist you need it, I don't think detection should be that difficult. When user comes to the page for the first time you put a hidden link somewhere with prefetch turned on. Then you ask server if the page has been accessed. And because you only make this check once (for instance on login page while the user is typing) it is performant enough.

Is it easier to whitelist? Sure. But we have seen here how reliable whitelisting is.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: