Search code examples
coding-stylebrowser

How to make a webpage display differently in different browsers?


I want to display the contents of a web page in a different format in different browsers. How to go about implementing it?

EDIT:More Information

The motivation behind this is to display the content in different mobile devices. For example: iPhone uses Safari So if a safari browser is used I will adjust the content so that it fits the screen of the iPhone perfectly and I can change the font size etc

If some other browser is used then I will change the format appropriately.


Solution

  • Check the contents of the User Agent header that is sent with the HTTP request. Until you tell us more about what you're using to display the page I can't be any more specific, but you should compare the User Agent header to known browsers and then serve up different content based on that test.