youtube / spfjs

A lightweight JS framework for fast navigation and page updates from YouTube
https://youtube.github.io/spfjs/
MIT License
2.23k stars 147 forks source link

Prefetching : need SPF identifier in url ? #403

Closed mrdoinel closed 8 years ago

mrdoinel commented 8 years ago

In the documentation, it is said that prefetch need a URL to navigate to, without the SPF identifier.

When I test this : spf.prefetch("/page"); It is throwing me an error. prefetch error (url= /page )

If I manually add the "?spf=navigate" or the "?spf=prefetch" parameter I don't have any issues. spf.prefetch("/page?spf=prefetch");

What is the good way to prefetch a URL ?

mrdoinel commented 8 years ago

I managed to fix it by setting cache-unified to true in main config options. spf.init({ "cache-unified" : true });

This way, this request : spf.prefetch("/page"); will append the SPF parameter (and the prefetch for the next navigation is working well!)