Solved

Alert Box for Javascript disabled browser

Posted on 2001-08-21
7
500 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
  • 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying 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

Suggested Solutions

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…

856 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