Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6099283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:15:21+00:00 2026-05-23T13:15:21+00:00

I’ve taken different approaches to find out whether JS is enabled / running correctly.

  • 0

I’ve taken different approaches to find out whether JS is enabled / running correctly.

Usually I just do something like this:

$('.jstest').html('JavaScript works.');

<p class='jstest'></p>

So, I can see whether I accidentally disabled JS, or I have a syntax error and JS is not running correctly without consulting firebug.

Now, this requires me to modify every single page. With Greasemonkey I thought this problem could be solved, without interfering with the site. But so far I couldn’t find a way. I’ve tried:

  • inserting a right after the opening body
  • inserting a script tag with a src to a remote server

Both ways still work, even if the JS on the site is not executed because of script / syntax errors.

Now, I’ve tried to insert a noscript container with Greasemonkey and disable js to find out whether the JS on the site reacts while Greasemonkey is not affected. No, GM does not work without JS 😛

It seems like GM is running independently from all other scripts on that site. Anybody know a solution?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:15:22+00:00Added an answer on May 23, 2026 at 1:15 pm

    Greasemonkey will run, even if the target page has JS disabled, because GM runs in its own, privileged sandbox.

    You can test if JS is available on the target page by injecting a JS function and then using GM to see if that function actually ran.

    Here’s a script that does that:

    // ==UserScript==
    // @name            _JS active test
    // @include         http://stackoverflow.com/questions/*
    // @include         http://www.nextdaypets.com/*
    // ==/UserScript==
    
    if (window.top != window.self)  //-- Don't run on frames or iframes (normally).
        return;
    
    //--- This function will be injected to see if JS is active on the target page.
    function TestPagesJS () {
        var testNode        = document.createElement ("span");
        testNode.setAttribute ("style", "display: none;");
        testNode.setAttribute ('id',    'SpecialNodeToTestIfPageJS_IsActive');
        document.body.appendChild (testNode);
    }
    
    //--- Inject the test JS and try to run it.
    var scriptNode          = document.createElement ("script");
    scriptNode.textContent  = TestPagesJS.toString () + '\nTestPagesJS ();';
    document.body.appendChild (scriptNode);
    
    /*--- Do not call this function from within a timer.  If you do, and the page's JS
        is disabled (NoScript, etc.), the alerts will not fire.
    */
    function CheckIsNodePresent () {
        var testNode        = document.getElementById ("SpecialNodeToTestIfPageJS_IsActive");
        if (testNode)
            alert ('Javascript works fine on the target page.');
        else
            alert ('Oops! Javascript is off or broken on the target page.');
    }
    
    CheckIsNodePresent ();
    

    Note that the two @include directives are for a site where I allow and disallow JS, respectively (using the NoScript add-on). (Script tests pass.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I would like to count the length of a string with PHP. The string
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
Seemingly simple, but I cannot find anything relevant on the web. What is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.