Solved

How can I check to see if JavaScript is enabled, and if not display a message to the user: JS needs to be enabled

Posted on 2011-03-16
7
231 Views
Last Modified: 2012-05-11
How can I check to see if JavaScript is enabled (when a page is loaded), and if not display a message to the user: JS needs to be enabled with a link (so I can have a page to say how to enabled javascript.
0
Comment
Question by:Computer Guy
7 Comments
 
LVL 12

Expert Comment

by:enachemc
ID: 35145111
0
 
LVL 19

Accepted Solution

by:
Rikin Shah earned 500 total points
ID: 35145137
<script type="text/javascript">
document.write("hi!")
</script>
<noscript>
<p>
Text which says "JS needs to be enabled"
and
<a href="somewhere">Link</a>
</p>
</noscript>
0
 
LVL 10

Expert Comment

by:Asim Nazir
ID: 35145149
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 9

Expert Comment

by:mayank_joshi
ID: 35145153
0
 
LVL 19

Expert Comment

by:Bardobrave
ID: 35146065
I usually like to put someting in the HTML that shows the message, and hide it through Javascript. This way, if javascript is enabled, the message is not shown, and if javascript isn't enabled, the message is shown.

<script>
 function onLoadHide () //Fired on body onLoad event
  {
    document.getElementById("hideMe").display = 'none';
  }
</script>
.....
<div id="hideMe" >Javascript MUST be enabled</div>
0
 
LVL 3

Author Comment

by:Computer Guy
ID: 35146097
How can I use the last example with <noscript>
0
 
LVL 19

Expert Comment

by:Rikin Shah
ID: 35146134
<noscript> is not required in last example.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
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 …
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…

910 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

21 Experts available now in Live!

Get 1:1 Help Now