Noscript Tag, JavaScript Disabled Warning and Google Penalty
Asked Answered
O

6

50

I have been using a noscript tag to show a warning when users have JavaScript disabled or are using script blocking plugins like Noscript. The website will not function properly if JavaScript is disabled and users may not figure out why it is not working without the warning.

After the latest Google algorithm shuffle, I have seen the daily traffic drop to about 1/3 of what it was in the previous months. I have also seen pages that were ranking #1 or #2 in the SERPS drop out of the results. After doing some investigating in webmaster tools, I noticed that "JavaScript" is listed as #16 in the keywords section. This makes no sense because the site has nothing to do with JavaScript and the only place that word appears is in the text between the noscript tags.

It seems that Google is now including and indexing the content between the noscript tags. I don't believe that this was happening before. The warning is three sentences. I'd imagine that having the same three sentences appearing at the top of every single page on the site could have a damaging effect on the SEO.

Do you think this could be causing a problem with SEO? And, is there any other method to provide a warning to users who have JavaScript disabled in a way that won't be indexed or read by search engines?

Obsolete answered 14/6, 2009 at 18:12 Comment(0)
O
16

Somebody on another forum mentioned using an image for the warning. The way I see it, this would have three benefits:

  1. There wouldn't be any irrelevant text for search engines to index.
  2. The code to display a single image is less bulky than a text warning (which gets loaded on every page).
  3. Tracking could be implemented to determine how many times the image is called, to give an idea of how many visitors have JavaScript disabled or blocked.

If you combine this with something like the non-noscript technique mentioned by J-P, it seems to be the best possible solution.

Obsolete answered 14/6, 2009 at 18:13 Comment(2)
Also, there won't be any text so disabled people with screen-readers won't be able to use your site. -1.Kneecap
@user9876, Nothing alt can't fix. (alt was designed for this, even.) However, it may get indexed by Google, then.Unni
P
46

Put the <noscript> content at the end of your HTML, and then use CSS to position it at the top of the browser window. Google will no longer consider it important.

Stack Overflow itself uses this technique - do a View Source on this page and you'll see a "works best with JavaScript" warning near the end of the HTML, which appears at the top of the page when you switch off JavaScript.

Pickering answered 18/6, 2009 at 17:37 Comment(2)
I put <noscript> at the end of HTML and use CSS like position:fixed; left:0px; top:0px; , but no success. can you explain with example code and details?Canadianism
@Amir: The example code is right here in this page - StackOverflow itself uses this technique. View this page with JavaScript switched off and you'll see it, then use your browser's developer tools to examine the HTML and CSS. If you still can't make it work, you should create a minimal JSFiddle that demonstrates the problem and ask a new question.Pickering
S
25

<noscript> is not meant for meaningless warnings like:

<noscript>
Oh, no! You don't have JavaScript enabled! If you don't enable JS, you're doomed. [Long explanation about how to enable JS in every browser ever made]
</noscript>

It's meant for you to provide as much content as you can, along with a polite mention that enabling JS will provide access to certain extra features. You'll find that basically every popular site follows this guideline.

Skeens answered 14/6, 2009 at 18:23 Comment(0)
E
22

I don't think using <noscript> is a good idea. I've heard that it is ineffective when the client is behind a JavaScript-blocking firewall - if the client's browser has JavaScript enabled the <noscript> tag won't activate, because, as far as the browser's concerned, JavaScript is fully operable within the document...

A better method IMO, is to have all would-be 'noscript' content hidden by JavaScript.

Here's a very basic example:

...
<body>

    <script>
        document.body.className += ' js-enabled';
    </script>

    <div id="noscript">
        Welcome... here's some content...
    </div>

And within your StyleSheet:

body.js-enabled #noscript { display: none; }

More info:

Eurhythmy answered 14/6, 2009 at 18:45 Comment(2)
That indicates a design flaw in the "firewall" system, not a problem with noscript.Skeens
Such firewall would probably block required script from being downloaded. Hence, if the className += ' js-enabled' is actually part of such external library, then the above might indeed reveal many more problems than <noscript> does. (Like here on SO the JS is fetched from the sstatic.net domain, and that code validates if jQuery has been loaded from googleapis.com. Combined with the above, it could also indicate if sstatic.net is blocked.)Isomagnetic
O
16

Somebody on another forum mentioned using an image for the warning. The way I see it, this would have three benefits:

  1. There wouldn't be any irrelevant text for search engines to index.
  2. The code to display a single image is less bulky than a text warning (which gets loaded on every page).
  3. Tracking could be implemented to determine how many times the image is called, to give an idea of how many visitors have JavaScript disabled or blocked.

If you combine this with something like the non-noscript technique mentioned by J-P, it seems to be the best possible solution.

Obsolete answered 14/6, 2009 at 18:13 Comment(2)
Also, there won't be any text so disabled people with screen-readers won't be able to use your site. -1.Kneecap
@user9876, Nothing alt can't fix. (alt was designed for this, even.) However, it may get indexed by Google, then.Unni
A
3

Just wanted to post an interesting tidbit related to this. For a site of mine I have ended up doing something similar to what stack overflow uses, but with the addition of a "find out more" link as my users are not as technical as this site.

The interesting part is that following advice of people aboce, my solution ditched the noscript tag, instead opting to hide the message divs with javascript. But I found that if firefox is waiting for its master password, this hiding of the message is interupted, so I think I will go back to noscript.

Amazement answered 3/8, 2010 at 3:10 Comment(0)
T
1

If you choose a solution based on replacing the div content (if js is enabled, then the div content gets updated) rather than using a noscript tag, be careful about how google views this practice:

http://support.google.com/webmasters/bin/answer.py?hl=en&answer=66353

I'm not sure google will consider it deceptive, but it's something to consider and research further. Here's another stackoverflow post about this: noscript google snapshot, the safe way

Tambac answered 1/11, 2012 at 14:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.