473,386 Members | 1,668 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,386 software developers and data experts.

PHP and/or Javascript

Hi,

I was wondering if anyone knows of a way to test if javascript is on with
PHP or any other language. I need to test if it is enabled and if it
isnt, redirect to another page. Any help greatly appreciated.

Cheers

Will

Jul 17 '05 #1
6 3073
willl69 wrote:
Hi,

I was wondering if anyone knows of a way to test if javascript is on
with PHP or any other language. I need to test if it is enabled and
if it isnt, redirect to another page. Any help greatly appreciated.


Only Javascript can test if Javascript is enabled.

Given that, you would be much better off asking this in comp.lang.javascript

Actually, you would be even better off searching the forum first, since this
exact question has been discussed at least twice in the past month. There
were a few decent solutions proposed - you could take your pick!

--
Tony Garcia
Web Right! Development
Jul 17 '05 #2
Hi Will,

If you want to test if Javascript is on in your browser make a file
called test.html with the following

<html>
<head>
</head>
<body>
<p>
<script language="javascript" type="text/javascript">
<!--
document.write("javascript is enabled in your browser. In your browser
preferences try turning javascript off and reload this page.")
// -->
</script>
<noscript>
javascript and is not enabled in your browser. In your browser
preferences try turning javascript on and reload this page.
</noscript>
</p>
</body>
</html>

So you do not need to use php to do the check. Like Tony said and the
above example shows, just use Javascript.

You might want to check out this page I put together. Download the
technologyExamples.zip files and read the readme. It is rough but
should help you out if you want to test other technology out (xml,
xslt,...).

http://members.shaw.ca/petermichaux/...echnology.html

-Peter

Jul 17 '05 #3
"" wrote:
Hi,

I was wondering if anyone knows of a way to test if javascript
is on with
PHP or any other language. I need to test if it is enabled
and if it
isnt, redirect to another page. Any help greatly appreciated.

Cheers

Will


Check out these newsgroup archives..

http://www.dbforumz.com/modules.php?...ect+javascript
http://www.dbforumz.com/modules.php?...ect+javascript
http://www.dbforumz.com/modules.php?...ect+javascript

The third ulr should work for you.

--
Posted using the http://www.dbforumz.com interface, at author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbforumz.com/PHP-Javascri...ict236576.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbforumz.com/eform.php?p=821262
Jul 17 '05 #4
willl69 wrote:
Hi,

I was wondering if anyone knows of a way to test if javascript is on with
PHP or any other language. I need to test if it is enabled and if it
isnt, redirect to another page. Any help greatly appreciated.

Cheers

Will


It'd be a lot easier to redirect using javascript - that way if it's not on
you'll know about it.

C.
Jul 17 '05 #5
JDS
On Wed, 29 Jun 2005 20:12:24 -0700, petermichaux wrote:
So you do not need to use php to do the check. Like Tony said and the


In fact, not only do you not *need* PHP to do the check, you really
*can't* use PHP to do the check!

Your code example is the only reliable way to check if JS is "on"

--
JDS | je*****@example.invalid
| http://www.newtnotes.com
DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/

Jul 17 '05 #6
Colin McKinnon wrote:
willl69 wrote:
Hi,

I was wondering if anyone knows of a way to test if javascript is on
with PHP or any other language. I need to test if it is enabled and
if it isnt, redirect to another page. Any help greatly appreciated.

Cheers

Will


It'd be a lot easier to redirect using javascript - that way if it's
not on you'll know about it.


And it doesn't rely on <noscript>, which doesn't always work.

--
Tony Garcia
Web Right! Development
Jul 17 '05 #7

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

Similar topics

0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.