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
235 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
[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
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
Independent Software Vendors: 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 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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
[form-control] Retain values after a POST action 21 66
Where is this content coming from? 4 34
XML loaded in a form with dropdown 6 47
Add Rows on a Table 8 46
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
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…

740 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