1

Is there anyway to make a window to popup if javascript disabled?

5
  • 2
    Perhaps you can use the noscript tag w3schools.com/tags/tag_noscript.asp Commented Mar 27, 2013 at 12:47
  • To display a message if javascript is disabled. Is there a rule against linking to w3schools? Or just your personal preference? Commented Mar 27, 2013 at 12:50
  • Have a read w3fools. It is very telling. w3schools are horrific Commented Mar 27, 2013 at 12:51
  • Other than using the target="_blank" on an anchor tag to open the link in a new window, there's nothing that will do what you're asking without JavaScript (or equivalent) Commented Mar 27, 2013 at 12:51
  • Actually you can use CSS as mentioned. Here is a cool link pauljablonski.net/pure-css-popup-for-any-content.html Commented Mar 27, 2013 at 12:52

2 Answers 2

6
<noscript>
    <style type="text/css">
        #body {display:none;}
        #alertdiv {display:inline;}
    </style>
</noscript>

where #alertdiv is a div designed to show the message you want (hidden by default) and #body the id of your main div that will be hidden if javascript is not activated. But it is optional.

A popup is a window.open command and doesn't exist without javascript. You have to emulate something similar. [update 2015: bootstrap, jquery... now offer wonderful ways of displaying alerts without requiring popups, as easily as $("#alert-box").modal("show");]

The idea is to use CSS to show parts of your page only when javascript is disabled.

Side-note: this won't validate w3c.

Sign up to request clarification or add additional context in comments.

Comments

1
<body>
    <div id="NoScriptPopup">Javascript is disabled on your browser</div>    
    <div id="YourContent">/*Your page content goes here*/</div>
    <style>
        #YourContent
        {
            display:none;
        }
    </style>
    <script>
        document.getElementById("NoScriptPopup").style.display = 'none';
        document.getElementById("YourContent").style.display = 'block';
    </script>
</body>

So if javascript is disabled on a browser, the #NoScriptPopup will appear and your content will be hidden. You could style #NoScriptPopup div using css to make it look like a popup.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.