简体   繁体   中英

How to load Desktop version of webpage through mobile PHP page (user agent settings?)

I have a PHP page (which is displayed through a mobile/android browser) - however, when accessing a link to an external site - it automatically redirects to the mobile version.

I want the link to take user to the desktop version of the webpage even when accessed through a mobile browser.

Is there a way i can specify useragent/or any other setting in my PHP page code to acheive this? Thanks.

Spoofing the user agent string will be a challenge, as it requires you to control the behavior of the browser. You might be able to do it with JavaScript or something, but I doubt it.

If it's just one site, you may wish to take a look at how they're handling redirection of mobile devices. Often, sites will provide mechanisms for overriding the redirect script.

For example, sites using the UC Mobile Web Framework (http://mwf.ucla.edu/) allows you to override their redirect script with a query string parameter. The UCSF Library (http://library.ucsf.edu/) is using that framework for mobile redirects. If you are on a mobile device and go to http://library.ucsf.edu/ then you will be redirected to the mobile version of the site. However, if you go to http://library.ucsf.edu/?ovrrdr=1 then you will get the desktop version.

What you are describing, no. You do not have control of an external site therefore you cannot control what is being served.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM