473,378 Members | 1,377 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 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 3297
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.