Jump to content

iphone?


ki

Recommended Posts

hmm i think javascript would reconize the iphone with its resolution or would lookup the browser name or engine or something.

and i dont think css would be able to do that. afterall its a stylesheet, not a browser plugin.

you might be able to create a stylesheet that would be compatible with the iphone, but then again how would your script know what stylesheet to use?

 

Link to comment
https://forums.phpfreaks.com/topic/79314-iphone/#findComment-401497
Share on other sites

I'll admit I'm not up to speed on developing sites for hand-helds or other small displays, but here's my advice.

 

You can be fancy and detect the browser via Javascript or PHP (via $_SERVER) as suggested, but some people will have Javascript turned off.  Others might have their browser configured to tell sites it is a different browser (which would render PHP's ability to correctly identify the user agent in $_SERVER useless).  So no matter what automatic detection you decide to use, it may fail, and you should still provide a 'Reload this page for a small display or hand-held device' link.

 

No matter how you determine to display your alternate .css (automatic detection or user action), set a flag in $_SESSION that tells the site to use the alternate .css.  Do it in $_SESSION because you can still use sessions even when cookies are disabled.

 

Additionally, set a permanent cookie in the user's browser that says to use the alternate style sheet.

 

On your visitor's next visit to the page, look for the permanent cookie and if it's present use the alternate stylesheet.  If it's not present, revert back to your automatic or user specified action.

Link to comment
https://forums.phpfreaks.com/topic/79314-iphone/#findComment-401560
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.