Noscript Tag, JavaScript Disabled Warning and Google Penalty

前端 未结 6 1161

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 prop

相关标签:
6条回答
  • 2020-12-02 10:57

    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.

    0 讨论(0)
  • 2020-12-02 10:57

    <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.

    0 讨论(0)
  • 2020-12-02 10:57

    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:

    • Replacing <noscript> with accessible, unobtrusive DOM/JavaScript
    • Reasons to avoid NOSCRIPT
    0 讨论(0)
  • 2020-12-02 11:06

    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.

    0 讨论(0)
  • 2020-12-02 11:18

    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.

    0 讨论(0)
  • 2020-12-02 11:19

    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

    0 讨论(0)
提交回复
热议问题