January 5, 201115 yr Hey, Im currently using the following code to detect iphone/itouch devices, I was wondering if anyone knows the line of code I will need to add so if its not a iphone/itouch and not a PC it directs to that site. i.e if no javascript? <script LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT"> <!-- if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) { if (document.cookie.indexOf("iphone_redirect=false") == -1) window.location = "iphone site"; } //--> </SCRIPT>
January 5, 201115 yr Hey, Im currently using the following code to detect iphone/itouch devices, I was wondering if anyone knows the line of code I will need to add so if its not a iphone/itouch and not a PC it directs to that site. i.e if no javascript? <script LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT"> <!-- if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) { if (document.cookie.indexOf("iphone_redirect=false") == -1) window.location = "iphone site"; } else { // put your code here } //--> </SCRIPT> I think the code you're thinking of is what I've added in bold, but you can't detect whether JavaScript is disabled. What we tend to do is use JavaScript to enable itself. We keep JavaScript as an optional extra so that any website will still work without JavaScript (but work better with JavaScript enabled). It's a process known as "progressive enhancement" (a good explanation is on A List Apart) and it may help you better understand your own question
January 6, 201115 yr Author I think the code you're thinking of is what I've added in bold, but you can't detect whether JavaScript is disabled. What we tend to do is use JavaScript to enable itself. We keep JavaScript as an optional extra so that any website will still work without JavaScript (but work better with JavaScript enabled). It's a process known as "progressive enhancement" (a good explanation is on A List Apart) and it may help you better understand your own question Thanks for the reply, Currently the code I am using is to detect if the user is on an iphone or itouch, if they are it redirects them to the site I have designed especially for them. As you probablly already know but I have also created a more watered down version for WAP and older phones and im strugling with how to detect them and redirect thats why I was thinking of a if no javascript redirect here kind of thing. Do you have any idea how i could/should go about that?
January 7, 201115 yr Author Still really need some help on this, would be really grateful if anyone could help. Thanks.
January 7, 201115 yr Thanks for the reply, Currently the code I am using is to detect if the user is on an iphone or itouch, if they are it redirects them to the site I have designed especially for them. As you probablly already know but I have also created a more watered down version for WAP and older phones and im strugling with how to detect them and redirect thats why I was thinking of a if no javascript redirect here kind of thing. Do you have any idea how i could/should go about that? Why don't you check for screen size too then? IF iDevice? Then send to iSite ELSE IF Screen Size <= iPhone/Touch screen size? then send to WAP Site ELSE Send to PC site.
Create an account or sign in to comment