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

Disabling JavaScript in Chrome doesn't trigger <noscript> #9

Closed
DivineDominion opened this issue Jan 31, 2014 · 4 comments
Closed

Disabling JavaScript in Chrome doesn't trigger <noscript> #9

DivineDominion opened this issue Jan 31, 2014 · 4 comments
Labels

Comments

@DivineDominion
Copy link

If you know how to test for the <noscript> path, please add a note to the Readme. Disabling JS in Chrome does prevent script execution. Meanwhile, the <noscript> tag is ignored, it seems.

What's your setup to test this?

@andrewicarlson
Copy link

It could be a couple things, I know Chrome has a history of ignoring (or forgetting) how <noscript> works by either totally ignoring what's inside or just dumping it as raw text.

Another issue could be your Doctype, to my knowledge <noscript> isn't supported in XHTML at all.

Have you tried testing it in FireFox?

@DivineDominion
Copy link
Author

In Firefox it indeed works like a charm.

For the sake of my current project, I hope no one is running Chrome and has JS disabled at the same time. Weird.

@kvendrik
Copy link
Owner

Hi @DivineDominion and @aicarlson,

Browsers pre-load images before any HTML, CSS or JS is applied. This makes it basically the same if you put an image in the src tag or put a separate img tag between HTML noscript tags.

This because as long as there is a src attribute the browser will pre-load the image anyway no matter what HTML around it says.

Browsers are too quick for us! In order to provide the fastest loading time possible, browsers preload all of the images that they can identify -- Choosing A Responsive Image Solution, Smashing Magazine

So in short: If you would like to create a fallback for non JS users (even though they will load two images). Then you could do something like:

<img src='demo/images/small.jpg' alt='kitten!' data-src-base='demo/images/' data-src='<480:smallest.jpg,
                                                          <768:small.jpg,
                                                          <960:medium.jpg,
                                                          >960:big.jpg' />

Instead of:

<img alt='kitten!' data-src-base='demo/images/' data-src='<480:smallest.jpg,
                                                          <768:small.jpg,
                                                          <960:medium.jpg,
                                                          >960:big.jpg' />

<noscript><img src='demo/images/small.jpg' alt='kitten!' /></noscript>

You can read more about this in the "Truly Responsive Images with responsive-images.js" article under the heading "No src attribute?".

Let me know what you think. :)

@andrewicarlson
Copy link

Yep. Makes sense.

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

No branches or pull requests

3 participants