Welcome to dbForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

PHP and/or Javascript

 
   Database Forums (Home) -> PHP RSS
Next:  JDBC Question: Getting data from tables with colu..  
Author Message
willl69

External


Since: Nov 30, 2004
Posts: 2



(Msg. 1) Posted: Wed Jun 29, 2005 10:18 pm
Post subject: PHP and/or Javascript
Archived from groups: comp>lang>php (more info?)

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

 >> Stay informed about: PHP and/or Javascript 
Back to top
Login to vote
Tony

External


Since: Jun 08, 2005
Posts: 10



(Msg. 2) Posted: Wed Jun 29, 2005 10:18 pm
Post subject: Re: PHP and/or Javascript [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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

 >> Stay informed about: PHP and/or Javascript 
Back to top
Login to vote
petermichaux

External


Since: May 26, 2005
Posts: 23



(Msg. 3) Posted: Wed Jun 29, 2005 10:18 pm
Post subject: Re: PHP and/or Javascript [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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/store/technology.html

-Peter
 >> Stay informed about: PHP and/or Javascript 
Back to top
Login to vote
steve




Joined: Jan 06, 2004
Posts: 655



(Msg. 4) Posted: Wed Jun 29, 2005 11:49 pm
Post subject: Re: PHP and/or Javascript [Login to view extended thread Info.]

Check out these newsgroup archives..

http://www.dbforumz.com/modules.php?name=Forums&file=viewtopic&t=218939&highlight=detect+javascript (http://www.dbforumz.com/modules.php?name=Forums&file=viewtopic&t=21893...ighligh)
http://www.dbforumz.com/modules.php?name=Forums&file=viewtopic&t=203805&highlight=detect+javascript (http://www.dbforumz.com/modules.php?name=Forums&file=viewtopic&t=20380...ighligh)
http://www.dbforumz.com/modules.php?name=Forums&file=viewtopic&t=175621&highlight=detect+javascript (http://www.dbforumz.com/modules.php?name=Forums&file=viewtopic&t=17562...ighligh)

The third ulr should work for you.
 >> Stay informed about: PHP and/or Javascript 
Back to top
Login to vote
Colin McKinnon1

External


Since: Apr 27, 2004
Posts: 43



(Msg. 5) Posted: Thu Jun 30, 2005 4:55 am
Post subject: Re: PHP and/or Javascript [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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.
 >> Stay informed about: PHP and/or Javascript 
Back to top
Login to vote
JDS

External


Since: Feb 15, 2005
Posts: 2



(Msg. 6) Posted: Thu Jun 30, 2005 9:21 am
Post subject: Re: PHP and/or Javascript [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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 | jeffrey.TakeThisOut@example.invalid
| http://www.newtnotes.com
DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/
 >> Stay informed about: PHP and/or Javascript 
Back to top
Login to vote
Tony

External


Since: Jun 08, 2005
Posts: 10



(Msg. 7) Posted: Thu Jun 30, 2005 10:25 am
Post subject: Re: PHP and/or Javascript [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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
 >> Stay informed about: PHP and/or Javascript 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
JavaScript to PHP? - I was just wondering that if it is possible to do almost anything you can do in JavaScript in PHP.

Javascript - I have a calendar formed with javascript. This line <script>this.form.orderdatefrom_Year_ID.value</script> returns the year-textbox.But in Javascript. How can I pass the javascript variable to php so to further use it?

php in javascript - I have create a checkbox,call getS function in onclick event. I append value of variable output with value $text. It works well but when I changed value of $text to a paragraph of text, it will occur error on the page. Please advise. Thanks. <script....

php within javascript - For a photo display I am using a javascript I found on the net (freeware). The Java script code has to be placed within head and /head tags The Java code consists of the start <script language="JavaScript1.2"> Then about 150 lines of ...

PHP or Javascript for this? - I'm wanting to create an hyperlink that will execute a mysql_query and then refresh the current page if it's clicked on. I've similar things created via javascript but didn't know if such was possible with PHP.
   Database Forums (Home) -> PHP All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]