0

I'm new to dealing with responsive website design but from what I have dabbled with its showing some great results.

I was wandering if some responsive experts can give some advice on serving alternative websites based on a mediaqueries for certain devices

Scenario A : If person a is using a desktop computer, serve this website to that device (HTML page 1)

B) If person is using a tablet, then serve mobile website. (HTML 2) But I will go further to say, Can you use this sort of method to deal out completely different html pages? eg mobilehtmlpage.html desktop.html if that makes sense?

Thanks for your help!

4

1 回答 1

0

You'll need to check to see what the "Web User Agent" is set to. This is basically the name of the browser.

You can do this in PHP like this: http://php.net/manual/en/function.get-browser.php

Here's a list of User Agents: http://www.useragentstring.com/pages/useragentstring.php

Once you check the User Agent, you'll be able to redirect the user based on this information (for example - subdomains: mobile.mysite.com and www.mysite.com). A lot of websites do this.

OR You could make a website that looks good regardless of the width of the browser, meaning you wouldn't need to redirect the user or know the user agent. This is my preferred method!

于 2013-10-16T17:39:30.103 回答