Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing a controller during (before?) first page load #54

Closed
yoavweiss opened this issue May 29, 2013 · 1 comment
Closed

Installing a controller during (before?) first page load #54

yoavweiss opened this issue May 29, 2013 · 1 comment

Comments

@yoavweiss
Copy link

Following the discussion in a previous bug (#50), and the public discussion around NavigationController as a prototype for a responsive images solution as well as CSP, I'm wondering what the stance is regarding the first page load.
Since the commonly used statistic for "empty cache users" is ~50% of users, I don't think that any non-cache related solution can be built to work only from the second load and up.
So, IMO, if we want to build NavigationController as a super-prolyfill building block (which would be awesome!), there should be a way to install the controller during the first page load, ideally before any resource needs to be fetched, to avoid blocking.

One way to enable this would be:

  1. Inline the controller code into the HTML's top, before any other resources are mentioned, in the case that the controller is not already installed
  2. Simplify the server side of step 1 by sending some sort of a "controller identifier" along with the request for the HTML, as an HTTP header. That would indicate the server if a controller is already installed, and if so which one. It'd also enable to "Vary" these responses in intermediate caches.
  3. Flag the inline controller script so that the preloader will know the controller needs to be parsed and installed before the preloader starts issuing requests.
  4. Install the controller on the first page load.

Does this sound reasonable?

@slightlyoff
Copy link
Contributor

There is no plan for blocking first load in controllers. Doing so requires not only downloading the entire controller, but also any resources it requires (via loadScripts()) as well as running the entire upgrade dance (oninstall, onactivate, etc.) WHICH CAN FAIL while we have blocked loading of the document.

It's better to hide the doucment you want to control with CSS, use .replace() to get notification of successful install ASAP, and use navigator.controller.ready() to be informed of success/failure.

Lastly, you can't inline controller code. The inception problem bites hard, and NC is being designed to avoid it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants