Page 1 of 1
different link target for different devices
Posted: Tue 6. Nov 2012, 13:56
by macangelo
Hi all
I want to provide a link to a location. If the website is opened on a mobile device with iOS 6 with the Map-App from apple the location should be target at
http://maps.apple.com/… - if not it should be
http://maps.google.com/… - can I do that?
Thanks a lot
Re: different link target for different devices
Posted: Tue 6. Nov 2012, 14:17
by nameless1
i guess
this is what you are looking for.
if you have any translation questions dont hesitate...
Re: different link target for different devices
Posted: Wed 7. Nov 2012, 16:27
by macangelo
Hi nameless1
Yes, I do have questions:
can the user agent ask if it is iOS6 or higher or not (because than I call for the map app, otherwise for the google map app)
does this <!--if:XXXX-->Do that<!--/if-->-Thing have an else-Thing?
thanks a lot!
macangelo
Re: different link target for different devices
Posted: Wed 7. Nov 2012, 16:34
by juergen
Re: different link target for different devices
Posted: Thu 8. Nov 2012, 08:21
by flip-flop
Please make a test in e.g. frontend_render/test_user_agent.php
Code: Select all
<?php
echo ("USER AGENT <br />\n --------------------------------- \n");
dumpVar($_SERVER['HTTP_USER_AGENT']);
echo ("phpwcms_getUserAgent <br />\n --------------------------------- \n");
dumpVar(phpwcms_getUserAgent());
?>
I do not know whether the php function HTTP_USER_AGENT returns the operating system version for iOS.
On Android devices, the OS version is displayed, e.g. for a GT-P6800
Code: Select all
Mozilla/5.0 (Linux; U; Android 4.04; de-de; GT-P6800 Build/XXYYZZ) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 Safari/ 534.13
However, this is not yet implemented in the CMS. You can even add to this distinction in an frontend_render script.
[UPDATE]
I think there is a way to exttract the OS from the User-Agent. This solution can be queried with the built in if statements. -> iOS_V4, iOS_V5, iOS_V6 .....
frontend_init:
The simple version:
User-Agent -> Extrahieren der OS Version von iOS
[/UPDATE]
Knut