472,992 Members | 3,234 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,992 software developers and data experts.

check javascripr enable/disable

I want to check through perl whether javascript is enabled or disabled
in mozilla browser. If it is disabled I want to display a message to
user to enable it. What code can I use please help.

I tried "navigator.javaEnabled() but it is in javascript again. If
javascript will be disabled so browser can neither read this code
even.

Thanks

Jul 30 '07 #1
6 3275
Anshul said the following on 7/30/2007 5:30 AM:
I want to check through perl whether javascript is enabled or disabled
in mozilla browser. If it is disabled I want to display a message to
user to enable it. What code can I use please help.

I tried "navigator.javaEnabled() but it is in javascript again.
navigator.javaEnabled() tells you whether Java is enabled or not, not
whether JS is enabled or not.
If javascript will be disabled so browser can neither read this code
even.
<noscript>Please enable scripting in your browser</noscript>

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jul 30 '07 #2
Anshul wrote:
I want to check through perl whether javascript is enabled or disabled
in mozilla browser.
You would need to use client-side scripting to submit an HTTP request
that is handled by the server-side Perl script if client-side script
support is enabled. For example:

<script type="text/javascript">
var img = new Image();
img.src = "http://foo.example/bar.pl?js=1";
</script>

Or, for another example, you could use XMLHttpRequest/IXMLHTTPRequest
for that. All solutions (have to) use a host object, and neither one is
guaranteed to be supported.
If it is disabled I want to display a message to
user to enable it. What code can I use please help.
Not possible using a server-side script without prior user interaction,
since it can only "know" when client-side script support is enabled as
the former has to be "notified" by the latter.
I tried "navigator.javaEnabled() but it is in javascript again. If
javascript will be disabled so browser can neither read this code
even.
You don't need any programming:

<noscript>...</noscript>

However, your approach is most likely wrong. Websites should work
without client-side script support.
PointedEars
Jul 30 '07 #3
Thomas 'PointedEars' Lahn said the following on 7/30/2007 5:49 AM:
Anshul wrote:
>I want to check through perl whether javascript is enabled or disabled
in mozilla browser.

You would need to use client-side scripting to submit an HTTP request
that is handled by the server-side Perl script if client-side script
support is enabled. For example:

<script type="text/javascript">
var img = new Image();
img.src = "http://foo.example/bar.pl?js=1";
</script>

Or, for another example, you could use XMLHttpRequest/IXMLHTTPRequest
for that.
Or, redirect using JS.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jul 30 '07 #4
On Jul 30, 3:09 pm, Randy Webb <HikksNotAtH...@aol.comwrote:
Anshul said the following on 7/30/2007 5:30 AM:
I want to check through perl whether javascript is enabled or disabled
in mozilla browser. If it is disabled I want to display a message to
user to enable it. What code can I use please help.
I tried "navigator.javaEnabled() but it is in javascript again.

navigator.javaEnabled() tells you whether Java is enabled or not, not
whether JS is enabled or not.
If javascript will be disabled so browser can neither read this code
even.

<noscript>Please enable scripting in your browser</noscript>

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/
Thanks Randy,

It helped me.

Bye

Jul 30 '07 #5
Randy Webb wrote:
Thomas 'PointedEars' Lahn said the following on 7/30/2007 5:49 AM:
>Anshul wrote:
>>I want to check through perl whether javascript is enabled or disabled
in mozilla browser.
You would need to use client-side scripting to submit an HTTP request
that is handled by the server-side Perl script if client-side script
support is enabled. For example:
[...]
Or, redirect using JS.
Which could break the Back button.
PointedEars
Jul 30 '07 #6
On Jul 30, 2:30 am, Anshul <anshul...@gmail.comwrote:
I want to check through perl whether javascript is enabled or disabled
in mozilla browser. If it is disabled I want to display a message to
user to enable it. What code can I use please help.

I tried "navigator.javaEnabled() but it is in javascript again. If
javascript will be disabled so browser can neither read this code
even.

Thanks
There are many messages in the archives of this newsgroup describing
why a check for JavaScript being enabled or not is insufficient. This
will not tell you if you scripts will run successfully.

<URL: http://www.jibbering.com/faq/faq_notes/not_browser_detect.html>

Peter

Jul 30 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: vncntj | last post by:
i want to enable one listbox and disable the other depending on if i check winter_gala (checkbox) here is my code. <script type="text/javascript"> function check() { if...
2
by: eddie wang | last post by:
Hello, I inherited an Access application from a previous coworker. It seems the Spell Check is never enabled unless I open the application by holding down the shift key and double clicking the...
3
by: DBQueen | last post by:
I have a form with lines of controls. On some of the lines there are 3 controls (call them A,B,C); other lines have only control A. The controls have been numbered sequentially (Q20, Q21....Q76)...
0
by: talal | last post by:
How to check whether javascript is enable or disable in client browser. Remeber i can check wheter browser client support javascript with BrowserCapability class. But what if the client has disable...
10
by: Just Me | last post by:
If I periodically check to see if the floppy is ready, the drive will each time make a little noise. I've been up against this before and could never find a way to check to see if the floppy...
4
by: John Salerno | last post by:
My code is below. The main focus would be on the OnStart method. I want to make sure that a positive integer is entered in the input box. At first I tried an if/else clause, then switched to...
8
by: rongchaua | last post by:
Hi all, i would like now to disable and enable network adapter programmatically with c#. I have searched but found nothing useful. There's no topic about this problem. Has someone done with this...
3
by: Pietro | last post by:
Hi all, First of all I'd like to thank you very very much ,as finally after many years of searching,I could find a code to disable/enable the shift key,but actually i cannot use the code as I'm...
3
by: thirish | last post by:
Hi, I have jsp page, on jsp page, The data is displaying from xml island. the Requriement is i have optional button and dropdown in each row. if user check the option button in second row then...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.