1

I was wondering if it's possible at all to do something like the following:

Let the website examine whether a visitor has Javascript enabled or not. If not a pop-up will appear telling them to enable JavaScript for a better website view.

It doesn't have to be a pop-up, it could be anything, really.

Is it even possible to do something like that without using JavaScript?

In the worst case scenario I just leave a plain text note in my footer or so.

japanworm
  • 129
  • 9

6 Answers6

5

Anything inside a <noscript> block will only be shown to people with JavaScript disabled or unavailable:

<noscript>
  Please enable JavaScript to see the awesomeness
</noscript>
Pointy
  • 405,095
  • 59
  • 585
  • 614
4

All you need is noscript tag

<noscript>
  Doh! No javascript?
</noscript>
archil
  • 39,013
  • 7
  • 65
  • 82
1

You could use <noscript>, but there may be unintended side effects. Instead, Include a <div>, and then remove it from the DOM on document.ready. That way, the message is sure to appear if your script doesn't run for any reason.

Community
  • 1
  • 1
josh3736
  • 139,160
  • 33
  • 216
  • 263
  • Those things are true, but anybody behind a JavaScript-eating firewall in this day and age is seeing a completely broken internet in general. – Pointy Sep 26 '11 at 14:28
  • That's true, but I'd be more concerned about the Google search ranking implications. – josh3736 Sep 26 '11 at 15:15
  • @josh3736 I tried to use the following instead of noscript, but this doesn't work for Internet Explorer!! :( `
    Welcome... here's some content...
    `
    – japanworm Oct 02 '11 at 05:53
0

Try this - Visual basic Script (For IE only):

<script type="text/vbscript">

MsgBox("Please Enable Javascript to experience the full quality of this page...")

</script>
Tobi
  • 133
  • 1
  • 7
0

From my reading here is a way to do it:

in your HTML add a text that tell the user to enable javascript for better view. Then on the load of the page remove the DOM.

source : "Jquery novice to ninja" p.64 In HTML

<p id="no-script"> We recommend that you have JavaScript enabled!</p> 

In Javascript

$('#no-script').remove();
David Laberge
  • 15,435
  • 14
  • 53
  • 83
  • Might be worth noting that your "In Javascript" example actually uses JQuery, not vanilla Javascript. – Michal Sep 26 '11 at 14:30
0

That's difficult to answer you because Java is not Javascript.

Javascript is a native browser language. Java is an advanced language which needs plugin to run on browser (applet).

If you talk about javascript, you can use the noscript tag.

If you talk about java, you can use javascript to show a popup because javascript is activated on 99% of browsers.

Jerome Cance
  • 8,103
  • 12
  • 53
  • 106