Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,149,980 members, 7,806,860 topics. Date: Wednesday, 24 April 2024 at 04:46 AM |
Nairaland Forum / Science/Technology / Webmasters / Dhtml Quiz: How Will You Detect If A Browser Support Javascript From Php Code? (1806 Views)
:: Dhtml Framework Evolution / Next Quiz: How Do You Detect With Php If Javascript Has Been Turned Off? / My Dhtml Board Games Project :: Featuring Ludo, Snakes And Ladder (2) (3) (4)
Dhtml Quiz: How Will You Detect If A Browser Support Javascript From Php Code? by Nobody: 3:15pm On May 01, 2011 |
Introduction: Yeah, as some of you probably know, i love javascript a lot, but these days i have repented sha. Task: I want to rebuild my website (this is true sha), but i want to have two versions - one version supports javascript and the other version uses no javascript. Layout: I have an index.php which is the first page to load. Now i want the index.php to load index_html.php if the client does not support javascript, or to use index_js.php if the client supports javascript. Note: there are many ways of doing this, lets see how you will solve it easily. |
Re: Dhtml Quiz: How Will You Detect If A Browser Support Javascript From Php Code? by yawatide(f): 8:08pm On May 01, 2011 |
I don't think there is a way to detect javascript via php. You could detect user agents though, which in itself can get tricky. Why not just employ progressive enhancement/graceful degradation in your coding? Give the user top of the line but provide appropriate fall back for those who don't support javascript? |
Re: Dhtml Quiz: How Will You Detect If A Browser Support Javascript From Php Code? by Nobody: 9:21pm On May 01, 2011 |
Graceful degradation is still the way. However, what i was implying was that how will you go about "detecting" that the browser does not support javascript and go ahead to redirect or set up a session or whatever that javascript: off so that the rest of your pages will be aware that the komputa no support javascript? I remember that i have made a post and given some codes about this several years ago on this board (at least 4-5 years back) - based on a project then. . . |
Re: Dhtml Quiz: How Will You Detect If A Browser Support Javascript From Php Code? by DualCore1: 9:33pm On May 01, 2011 |
Lower the bars for subsequent quizzes to attract more attempts on it. Most of these quizzes na yawa and 2 or 3 people dey participate |
Re: Dhtml Quiz: How Will You Detect If A Browser Support Javascript From Php Code? by Nobody: 9:41pm On May 01, 2011 |
Well, try out this php script http://.net/demos/jsdetect/ You can turn on javascript and test it, and turn it off also. It can be used to solve this task. Dual Core:How do i lower the bars? |
Re: Dhtml Quiz: How Will You Detect If A Browser Support Javascript From Php Code? by ogzille(m): 1:22am On May 02, 2011 |
<noscript></noscript> |
Re: Dhtml Quiz: How Will You Detect If A Browser Support Javascript From Php Code? by Nobody: 6:16am On May 02, 2011 |
The example is i posted is more like it. Source code: http://.net/demos/jsdetect/jsdetect.txt |
Re: Dhtml Quiz: How Will You Detect If A Browser Support Javascript From Php Code? by ogzille(m): 7:56am On May 02, 2011 |
nice trick, but is there any disadvantage of using the <noscript> tag or to redirect users to the js enabled page from a non js version if script is detected? |
Re: Dhtml Quiz: How Will You Detect If A Browser Support Javascript From Php Code? by Nobody: 8:16am On May 02, 2011 |
There is really no impossible there, however, using noscript will be slower in this case. You can say: <noscript> <img src="phpsess.php"> /*this can set up a session if jscript is enabled or not*/ but that method i used is shorter and much more efficient than this </noscript> |
(1) (Reply)
How I Recover My Hacked Google Adsense Account / Please I Need Help About Sending Bulk Emails / Corporate Website Designer
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 14 |