Solved

Alert Box for Javascript disabled browser

Posted on 2001-08-21
7
501 Views
Last Modified: 2012-05-04
I would like to have an alert box which will pop up if the user has disabled Javscript on their machine, or if they are not using a Javascript enabled browser.  Basically a client-side sniff to detect whether their browser can do Javscript.  If not, the alert box pops up with a message.
0
Comment
Question by:SteveH012698
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 19

Expert Comment

by:webwoman
ID: 6411099
I don't think so.. the alert box IS javascript. So if they don't have it enabled, it's not going to work.

Use a <noscript>tag

Like this

<noscript>Turn on javascript!</noscript>

That will work...
0
 

Author Comment

by:SteveH012698
ID: 6411166
That's what I thought... The <noscript> way could also be done with a redirected .asp page right off the server. Is there a way to put a detection script in the page that would launch a sized popup window if they have Javascript disabled? <body onLoad tag?> Something that would run when the page is loaded and launch a window, with a message, if they can't do Javascript.
0
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 100 total points
ID: 6411222
Maybe something like this:

<html>
<head>
<style>
   .alertcls {width:200;height:150;background:navajowhite;border-width:2;
              border-color:slateblue;position:absolute;left:150;top:150;
              z-index:20;}
</style>
</head>
<body>
<noscript>
<div class="alertcls">
   Sorry you cannot run this page correctly with scripting turned off
</div>
</noscript>
the normal stuff of the page goes here
</body>
</html>

Cd&
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 19

Expert Comment

by:webwoman
ID: 6411319
But... if I remember correctly, NN4+ turns off CSS when you turn off javascript... ;-)
0
 

Author Comment

by:SteveH012698
ID: 6411321
COBOL, in IE4 at least, that doesn't launch a popup window.  It prints the "Sorry you cannot run this page correctly with scripting turned off", message into a box on the page.  If you want to turn your scripting off & check it, go to:
http://www.houston-business.com/nojsalert.htm
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 6411397
It's not supposed to put up a popup just a layer on top of anyother content.

You cannot launch a popup or do much of anything else without Javascript.  The styling is just out a little.  If there is no CSS support it still just displays the text.

Cd&
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 6418083
Glad we could help.  Thanks for he A. :^)

Cd&
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question