Solved

Alert Box for Javascript disabled browser

Posted on 2001-08-21
7
496 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 19

Expert Comment

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

Author Comment

by:SteveH012698
Comment Utility
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
Comment Utility
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
Comment Utility
Glad we could help.  Thanks for he A. :^)

Cd&
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now