I got my viptopia site to do all the phones right.. but now im trying to get rangerschat to switch over to the wap for all apple devices, i was able to get the phones to switch and ipods.. but i cant get the ipad2 to switch,, does anyone here know a auto redirect code that will work for ipad2's? MY SITES http://viptopia.net general social networking | http://www.rangerschat.com/ niche site |
How are you doing your current redirection?
Are you matching user agent strings?
https://www.deanbassett.com |
Not sure I understand but would say, check your viptopia site.
Further to that, it seems the only way to detect an ipad2 is checking for a camera. This is what differentiates the ipad from the ipad2
Dedicated servers for as little as $32 (28 euro) - See http://denre.com for more information |
deano i am so sorry man i went to click "quote" on your post and hit report on mistake,, doing 50 things at once here with no sleep so please forgive me
im redirecting with this
$iphone = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone"); $ipod = strpos($_SERVER['HTTP_USER_AGENT'],"iPod");
if ($iphone || $ipod == true) { echo "<script>window.location='http://www.rangerschat.com/m/wap/service/mainMenu'</script>"; }
in the index.php
MY SITES http://viptopia.net general social networking | http://www.rangerschat.com/ niche site |
what do you mean "check" my site?
Not sure I understand but would say, check your viptopia site.
Further to that, it seems the only way to detect an ipad2 is checking for a camera. This is what differentiates the ipad from the ipad2
MY SITES http://viptopia.net general social networking | http://www.rangerschat.com/ niche site |
Then simple.
All user agent strings for the iPad have the word iPad in them. So to match both the iPad and the iPad2 you match for the word iPad
To match only the iPad look for the word Mobile/8F190
To match only the iPad2 look for the word Mobile/8F191
So add this.
$ipad = strpos($_SERVER['HTTP_USER_AGENT'],"iPad");
Or this.
$ipad = strpos($_SERVER['HTTP_USER_AGENT'],"Mobile/8F190"); $ipad2 = strpos($_SERVER['HTTP_USER_AGENT'],"Mobile/8F191");
https://www.deanbassett.com |
I also saw some javascript detection code you appear to have placed in your _header.html file.
So how do you know which one is doing the actual detection and redirection?
One of them should be removed.
https://www.deanbassett.com |
Then simple.
All user agent strings for the iPad have the word iPad in them. So to match both the iPad and the iPad2 you match for the word iPad
To match only the iPad look for the word Mobile/8F190
To match only the iPad2 look for the word Mobile/8F191
So add this.
$ipad = strpos($_SERVER['HTTP_USER_AGENT'],"iPad");
Or this.
$ipad = strpos($_SERVER['HTTP_USER_AGENT'],"Mobile/8F190"); $ipad2 = strpos($_SERVER['HTTP_USER_AGENT'],"Mobile/8F191");
you are a freaking genius!!.. i looked with google for an hour before coming here and asking all they had there was some java scripts that never worked when i put them in the subheader or anywhere for that matter lol
thanks AGAIN dude.. if you are ever in houston let me know i owe you a few beers
MY SITES http://viptopia.net general social networking | http://www.rangerschat.com/ niche site |
The javascript user agent Mobile string (Mobile/9A405) seems to be dependent on the CPU OS version. So, while some places it may differ by iPad generation, it's often because the CPU OS version is different.
EXAMPLE 1 - different CPU OS = different Mobile/string:
iPad 1 - Mozilla/5.0 (iPad; CPU OS 5_0_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A405 Safari/7534.48:3
iPad 2 - Mozilla/5.0 (iPad; CPU OS 5_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B176 Safari/7534.48:3
EXAMPLE 2 - same CPU OS = same Mobile/string:
iPad 1 - Mozilla/5.0 (iPad; CPU OS 5_0_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A405 Safari/7534.48.3
iPad 2 - Mozilla/5.0 (iPad; CPU OS 5_0_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A405 Safari/7534.48.
source: http://stackoverflow.com/questions/6230243/detect-between-the-ipad-and-ipad2-via-jquery-javascript
Dedicated servers for as little as $32 (28 euro) - See http://denre.com for more information |
simple cause i was testing before i added it and the phones worked but could never get the ipad to.. so i just left with and just now pulled it and it is still working like a champ!
I also saw some javascript detection code you appear to have placed in your _header.html file.
So how do you know which one is doing the actual detection and redirection?
One of them should be removed.
MY SITES http://viptopia.net general social networking | http://www.rangerschat.com/ niche site |
well it works perfect now so im happy with it.. now on to the biggest problem i have had for the past 4 days.. an non flash andriod player that will steam a shoutcast stream,,, have a feeling this is gonna be the one that beats me and makes me have to hire someone to custom build it :( MY SITES http://viptopia.net general social networking | http://www.rangerschat.com/ niche site |
well deano seems i spoke too soon.. while the code you gave me did redirect the ipad2 .. what i didnt notice till now was it also redirected every thing including my desktop that went to tangerschat.com..
im pretty sure it wasnt this bit " $ipad = strpos($_SERVER['HTTP_USER_AGENT'],"Mobile/8F190"); $ipad2 = strpos($_SERVER['HTTP_USER_AGENT'],"Mobile/8F191"); " that caused the problem cause i added it back and now it will not redirect the desktop or the ipad2 now .. but the first time when i added that i also added " | $ipad | " to the if line so it went from this>>> if ($iphone || $ipod == true) to this>>> if ($iphone | | $ipad| | $ipod == true) so it must be the "|$ipad| that was causing everything to redirect but when i take that out and just leave those 2 lines of yours in there it wont work.. here is what i have setting in there now
$iphone = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone"); $ipod = strpos($_SERVER['HTTP_USER_AGENT'],"iPod"); $ipad = strpos($_SERVER['HTTP_USER_AGENT'],"Mobile/8F190"); $ipad2 = strpos($_SERVER['HTTP_USER_AGENT'],"Mobile/8F191"); if ($iphone || $ipod == true) { echo "<script>window.location='http://www.rangerschat.com/m/wap/service/mainMenu'</script>"; }
MY SITES http://viptopia.net general social networking | http://www.rangerschat.com/ niche site |
It may be the way your forming your if statement which appears incorrect to me based on my knowolge of php. One is strpos does not return a boolean true. It returns a number or false if not found which should not make a difference, but lets try using something different.
Try This instead.
$iphone = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone"); $ipod = strpos($_SERVER['HTTP_USER_AGENT'],"iPod"); $ipad = strpos($_SERVER['HTTP_USER_AGENT'],"iPad");
if (($iphone !== false) || ($ipod !== false) || ($ipad !== false)) { echo "<script>window.location='http://www.rangerschat.com/m/wap/service/mainMenu'</script>"; }
Or you could try this one.
$iphone = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone"); $ipod = strpos($_SERVER['HTTP_USER_AGENT'],"iPod"); $ipad = strpos($_SERVER['HTTP_USER_AGENT'],"iPad");
if ($iphone || $ipod || $ipad) { echo "<script>window.location='http://www.rangerschat.com/m/wap/service/mainMenu'</script>"; }
The first one is the better choice as it deals with the false condition which can only occur if not found, but the other way can return a 0 if the position is 0 which is a match but the true based code would not catch it. https://www.deanbassett.com |
You also were not checking for true on both sides of the || (or) which also should be done.
See this page for more information on the proper use of strpos http://php.net/manual/en/function.strpos.php
https://www.deanbassett.com |
welp the first one worked like a freaking charm!!.. and yes i tested the others before i ran and posted this time lol
thanks a million!
It may be the way your forming your if statement which appears incorrect to me based on my knowolge of php. One is strpos does not return a boolean true. It returns a number or false if not found which should not make a difference, but lets try using something different.
Try This instead.
$iphone = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone"); $ipod = strpos($_SERVER['HTTP_USER_AGENT'],"iPod"); $ipad = strpos($_SERVER['HTTP_USER_AGENT'],"iPad");
if (($iphone !== false) || ($ipod !== false) ||($ipad !== false)) { echo "<script>window.location='http://www.rangerschat.com/m/wap/service/mainMenu'</script>"; }
Or you could try this one.
$iphone = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone"); $ipod = strpos($_SERVER['HTTP_USER_AGENT'],"iPod"); $ipad = strpos($_SERVER['HTTP_USER_AGENT'],"iPad");
if ($iphone || $ipod || $ipad) { echo "<script>window.location='http://www.rangerschat.com/m/wap/service/mainMenu'</script>"; }
MY SITES http://viptopia.net general social networking | http://www.rangerschat.com/ niche site |
ahh i see,, well like i said imon days with very little sleep so yeah i am suprized it wasnt even more of a mess,, and thanks very much for that link i can tell you now i am gonna use the hell out of that, never even knew that site existed.
You also were not checking for true on both sides of the || (or) which also should be done.
See this page for more information on the proper use of strpos http://php.net/manual/en/function.strpos.php
MY SITES http://viptopia.net general social networking | http://www.rangerschat.com/ niche site |
so much to do.... |