different link target for different devices

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
macangelo
Posts: 756
Joined: Sat 29. Nov 2003, 14:19
Location: Düsseldorf
Contact:

different link target for different devices

Post 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
Webdesign from Düsseldorf - made with phpwcms (most of it):
http://eyelikeit.com/index.php?de_beispiele-webdesign
nameless1
Posts: 882
Joined: Sun 27. Apr 2008, 23:22

Re: different link target for different devices

Post by nameless1 »

i guess this is what you are looking for.

if you have any translation questions dont hesitate...
macangelo
Posts: 756
Joined: Sat 29. Nov 2003, 14:19
Location: Düsseldorf
Contact:

Re: different link target for different devices

Post 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
Last edited by macangelo on Wed 7. Nov 2012, 16:39, edited 1 time in total.
Webdesign from Düsseldorf - made with phpwcms (most of it):
http://eyelikeit.com/index.php?de_beispiele-webdesign
User avatar
juergen
Moderator
Posts: 4556
Joined: Mon 10. Jan 2005, 18:10
Location: Weinheim
Contact:

Re: different link target for different devices

Post by juergen »

User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

Re: different link target for different devices

Post 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
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
Post Reply