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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.