check if Javascript is enabled and take actions

Hi,
I want to add a couple of pop-up boxes in my page, and I want to know :
1) is there a small piece of code that I must paste in my page which will check to see if the client has JS enabled?
2) do I use the <noscript> tag to enter the page that the user with no JS enabled will see?
3) if a user has JS enabled, do I need to check also if there are pop-up blockers, or it will be ok and my pop-up will open with no problem?

What I want basically is:
I have a link in the page ,which, if JS is enabled will open in a pop-up window when the user clicks on it, whereas, if JS is disabled, it will open in a new page, like plain, ordinary links

Thanks in advance
[705 byte] By [ktsirig] at [2007-11-19 20:40:40]
# 1 Re: check if Javascript is enabled and take actions
Then use <script> and <noscript>. If JavaScript is enabled, then it will fire, it is is not enabled then it won't. It is as simple as that.
PeejAvery at 2007-11-8 0:22:42 >
# 2 Re: check if Javascript is enabled and take actions
Taking what Paul has mentioned one tiny step further. Apart from determining whether or not JS is enabled / disabled, you can also check which version of JavaScript the particular browser supports.
Have a look at this example:
<HTML>

<!-- This file is a compatibility-check "gateway" leading into the -->
<!-- frames-generating file, jspfset.htm. -->
<!-- It displays appropriate warnings for users with incompatible -->
<!-- Web browsers and/or JavaScript language versions. -->

<HEAD>

<!-- guarantee that this file will never be cached ------ -->

<META HTTP-EQUIV="expires" CONTENT="Tue, 01 Jan 1981 01:00:00 GMT">

<!-- check for non-JS-enabled browsers --------- -->

<NOSCRIPT> <!-- if non-JS-enabled, display non-js.htm -->
<META HTTP-EQUIV="refresh" CONTENT="0; URL=non-js.htm">
</NOSCRIPT>

<!-- check for client browser ------------ -->

<SCRIPT LANGUAGE="JavaScript">
<!-- start JS hide
var g_browserApp = "";
var g_version = 0;
if (navigator.appName=="Netscape")
g_browserApp = "Netscape";
else if (navigator.appName == "Microsoft Internet Explorer")
g_browserApp = "Explorer";
else
g_browserApp = "other";
// end JS hide -->
</SCRIPT>

<!-- check for version -------------- -->

<SCRIPT LANGUAGE="JavaScript">
<!-- start JS hide
g_version = 10; // client browser supports JS 1.0
// end JS hide -->
</SCRIPT>

<SCRIPT LANGUAGE="JavaScript1.1">
<!-- start JS hide
g_version = 11; // client browser supports JS 1.1
// end JS hide -->
</SCRIPT>

<SCRIPT LANGUAGE="JavaScript1.2">
<!-- start JS hide
g_version = 12; // client browser supports JS 1.2
// end JS hide -->
</SCRIPT>

<!-- gateway ---------------- -->

<SCRIPT LANGUAGE="JavaScript">
<!-- start JS hide

if (g_version < 11) // JS 1.0 Netscape or Explorer
{
alert("This page relies heavily on JavaScript 1.2.\n" +
"You need Netscape 4.x (or higher) to view it properly.\n" +
"Internet Explorer (3.x, 4.x, whatever) might NOT work!");
location.href = "jspfset.htm";
}
else // JS 1.1+ Netscape or Explorer
{
if (g_browserApp == "Explorer") // JS 1.2+ Explorer
alert("This page relies heavily on JavaScript 1.2.\n" +
"You need Netscape 4.x (or higher) to view it properly.\n" +
"Internet Explorer (3.x, 4.x, whatever) might NOT work!");
else if (g_version < 12) // JS 1.1 Netscape
alert("This page relies heavily on JavaScript 1.2.\n" +
"You need Netscape 4.x (or higher) to view it properly.");
// use replace() instead of href to enable browser Back key
location.replace("jspfset.htm"); // JS 1.2+ Netscape
}

// end JS hide -->
</SCRIPT>

</HEAD>

<BODY BGCOLOR="black" TEXT="#CC0000">

<CENTER>
<H2>Loading (please wait) ..... </H2>
</CENTER>

</BODY>

</HTML>
HanneSThEGreaT at 2007-11-8 0:23:46 >
# 3 Re: check if Javascript is enabled and take actions
excellent help guys... A fellow from another forum suggested I use the return false; ending after the I write the pop-up. It actually works fine and opens a new window (identical to target=_blank).
Will definately check what HanneSThEGreaT suggested though... It's good to learn things!
ktsirig at 2007-11-8 0:24:47 >