如何强制加载桌面版本的网站(更改用户 - 代理不起作用)? -- browser 领域 和 asus-eee-pad-transformer 领域 和 3.2-honeycomb 领域 和 dolphin-browser 领域 和 user-agent-string 领域 android 相关 的问题

How to force load desktop version of website (changing user-agent doesn't work)?


简体版||繁體版
7
vote

问题

中文

某些网页强制移动版本甚至我更改了用户代理。 我在内置浏览器中更改了User-Agenter和"Dolphin浏览器HD" , 我在页面www.user-agent-string.info

上检查它

主要问题是Engadget.com,始终在移动版中。 我试图清洁cookie,重启浏览器等。

这是我的结果:

    在内置浏览器中,用户代理 - "桌面" 中的
    • ( allegro.pl )不起作用,重定向到移动版本

  1. 在"Dolphin浏览器HD" 中,用户 - 代理 - "桌面"

    • (nsfw:redtube.com)不起作用,重定向到移动版本
    • (allegro.pl)工作罚款
  2. 在"Dolphin浏览器HD" 中,用户 - 代理 - "ipad"

    • ( engadget.com )不起作用,重定向到移动版本
    • (allegro.pl)工作罚款
    • (nsfw:redtube.com)工作正常
  3. 在"海豚浏览器HD" 中,用户代理 - "自定义" : Mozilla / 5.0(Windows NT 6.0; RV:7.0.1)Gecko / 20100101 Firefox / 7.0.1

    • (engadget.com])不起作用,重定向到移动版本
    • (nsfw:redtube.com)不起作用,重定向到移动版本
    • (allegro.pl)工作罚款

可能使用"Adobe Flash" 用户代理检测?

(i'AM使用华硕变压器TF101,Android 3.2.1,Adobe Flash Player 11)

英文原文

Some webpages forces mobile version even I change user-agent. I changed user-agent in built-in browser and "Dolphin Browser HD", I am checking it on page www.user-agent-string.info

Main problem is engadget.com, always in mobile version. I tried to clean cookies, restart browsers etc.

This is my results:

  1. in built-in browser, user-agent - "desktop"

    • (allegro.pl) doesn't work, redirects to mobile version
  2. in "Dolphin Browser HD", user-agent - "desktop"

    • (NSFW: redtube.com) doesn't work, redirects to mobile version
    • (allegro.pl) works fine
  3. in "Dolphin Browser HD", user-agent - "IPad"

    • (engadget.com) doesn't work, redirects to mobile version
    • (allegro.pl) works fine
    • (NSFW: redtube.com) works fine
  4. in "Dolphin Browser HD", user-agent - "custom": Mozilla/5.0 (Windows NT 6.0; rv:7.0.1) Gecko/20100101 Firefox/7.0.1

    • (engadget.com]) doesn't work, redirects to mobile version
    • (NSFW: redtube.com) doesn't work, redirects to mobile version
    • (allegro.pl) works fine

Maybe this pages using "adobe flash" user-agent detection ?

(I'am using Asus Transformer TF101, Android 3.2.1, Adobe Flash Player 11)

              
       
       

回答列表

5
 
vote

这可能与userAgent无关 - 而是使用响应设计。拍摄我的Android网站:我根本不评估你的ua。使用移动设备尝试该网站,使用您想要的UA和Cookie - 除非您更改屏幕分辨率,否则结果将始终相同。

  @media (max-width: 600px) {   // adjustments for small screens go here }   

这是我网站风格表的片段。一旦屏幕宽度(这不是屏幕的物理宽度,而是浏览器窗口的宽度),就会看到,将应用特殊的CSS:以保持内容可读和聚焦,例如选项卡左到顶部(或底部,根据浏览器如何解释CSS)以及其他几件事。

这意味着:对于此类站点,"强制桌面变体" 的唯一方法将是播放屏幕密度 - 这需要root,可能有一些不需要的副作用(将密度设置得太高,并且您不能再读取任何内容,因为字体GET太小,只是为了命名一个相当无害的例子)。

 

This might have nothing to do with the UserAgent xe2x80x93 but rather use other means of responsive design. Take my Android site for example: I don't evaluate the UA at all. Try the site with your mobile device, play with UA and Cookies all you want xe2x80x93 unless you change your screen resolution, results will always be the same.

@media (max-width: 600px) {   // adjustments for small screens go here } 

That's a snippet from my site's style sheets. You see, as soon as screen width (that's not the physical width of the screen, but the width of the browser window) drops below 600px, special CSS will be applied: to keep the content readable and focused, for example the tabs go from the left to the top (or bottom, depending on how the browser interprets the CSS), and several other things.

Which means: For such sites, the only way to "force the desktop variant" would be to play with screen density xe2x80x93 which requires root and might have some unwanted side-effects (set the density too high, and you cannot read anything anymore as the fonts get too small, just to name a rather harmless example).

 
 
 
 
2
 
vote

注意:

  • 这个答案是为了解决赏金的笔记(由 abhishek anand ",因此,与原始暨历史问题不大。

    赏金说明

    必须有更好的方法来[do]。如果Web服务器忽略了用户代理值并查看屏幕尺寸,则必须有一种伪造屏幕大小的方法。

  • as现在,这个答案只与用于Android的Firefox浏览器。

izzy的回答解释我们这个问题很可能是网站的响应设计,这是一个可以的设计忽略用户代理,并最终选择用户的选择。

响应设计根据浏览器窗口的维度调整网站的UI。即,在桌面上,如果您打开 www.cs.princeton.edu/research/areas或 android.zzzysoft.de/articles.php (两个网站使用响应性设计)一个新窗口并使用鼠标或快捷方式调整窗口的大小,您将在桌面到平板电脑到移动方面见证设计的转换。

此行为意味着网站认为浏览器窗口的尺寸是屏幕的真实维度。

在Firefox中,来自此行为的补救措施是更改密钥 layout.css.devPixelsPerPx 的值。您可以通过在URL栏中键入 abcdefghijklmnabout:config 后跟搜索 layout.css.devPixelsPerPx 。默认值将设置为-1.0。双击值以编辑它。

每拱wiki的 firefox调整和此答案在jscher2000对Mozilla支持,将值更改为1.0将相当于拥有a 96 dpi的屏幕(你的 pov 可能有所不同),经常发现dpi监视器。将值调整为1.0或2.0或甚至从-1.0到1.0的范围。 非常谨慎在FullHD或UltraHD智能手机上使用值小于1.0,因为字体大小可能变得难以辨认。

我发现了1.0的5.5 " fullhd decete和0.4,我的5.0 " non-hd设备是桌面模式的最佳值。

示例屏幕截图:

  • 第一个图像:默认值为-1.0
  • 第二图像:我的fullhd设备的值为1.0
  • 第三图像:对于我的非高清设备的值为0.4

(单击图像放大)

img:1 img:2 img:3

缺点

  • 调整的效果是普遍的,因此,每个站点都会显示在桌面布局中或您选择的布局,直到您将值恢复为-1.0。
  • 某些网站也可以依赖于用户代理,因此可能需要两者的变化。

辅助设备的放松

如果您不断使用响应设计访问一些特定的网站,但仅在桌面模式下,到 about:config 可以非常令人厌倦。

在这种情况下,您可以使用这些灵活的命令:

(需要 busybox 已安装)< / sub>

  • 将布局更改为桌面

     am Force-stop org.mozilla.firefox; 睡觉1; sed -i' $ auser_pref("layout.css.devpixelsperpx" ,"1.0" );' /data/data/org.mozilla.firefox/files/mozilla/*.default/prefs.js; 猴子-p org.mozilla.firefo. 1 

    这里:

    • am :活动经理;强制停止Firefox,否则,更改不会生效
    • sleep :等待进一步执行前的 N 秒;需要一些旧的和慢速设备,如我的旧设备
    • sed :流编辑器;正在添加将布局设置为桌面的配置。 1.0 应由最后一节中最终结束的值替换。

      注意提及 /data/data/org.mozilla.firefox/files/mozilla/*.default/prefs.js 将导致更改在每个Firefox配置文件中进行。要使命令配置文件特定,请将 *.default 替换为配置文件目录的名称。

    • about:config0 :虽然适用于压力测试应用程序,但它有助于我们启动Firefox
    • 的启动器活动
  • 返回默认移动布局

     am Force-stop org.mozilla.firefox;睡觉1; sed -i'/.*layout.css.devpixelsperpx.*/d' /data/data/org.mozilla.firefox/files/mozilla/*.default/prefs.js; monkey -p org.mozilla.firefox 1 

    我们只需删除具有布局配置的行。


现实世界使用

如何使用上一节中的两个命令完全取决于您。

我可以推荐:

  • lmt launcher 。它可以选择将脚本分配给派来(请参阅示例)。在脚本下,您可以复制 - 粘贴整个命令。它还可以将应用程序快捷方式分配给馅饼,因此您可以使用 tasker 或 macrodroid 或安全设置。后一个应用程序可以执行命令。

  • gmd gesturecontrol 。使用手势来控制设备,或者为我们的情况进行控制,执行我们的命令。对于基本的详细信息和用法,请参阅我的答案这里和这里。您需要第三方应用程序,如Tasker或命令执行部分的安全设置。

  • 所有在一个手势。此应用程序还可以使用手势来控制设备。与最后一个应用程序一样,命令执行需要第三方支持。如果需要,请参阅我的答案非常基本的信息。
  • GravityBox 。也许是一个神奇的盒子。您可以使用它来显示将在点击时执行命令的馅饼,或在快速设置栏中添加自定义图块(请参阅示例)。如下,请参阅我的答案的第一个部分这里
  • 覆盖 - 到处都是。让我想起这个示例(图像源)您可以在其中添加东西到全局,隐藏但是在请求中可用,侧边栏。再次,您需要第三部分应用程序来执行命令。对于用法,请参阅官方网站或我的答案在这里

注意:

  • 这个答案的第二部分在回答在 Web浏览器 - 如何传递真正的原始分辨率,以防止站点服务于移动响应设计。
  • 屏幕截图的网站和应用程序建议用于演示目的o 莉。 海报不是附属于任何东西。
  • 用于Android用户的Chrome :可以使用命令行标志来扩展网站。 尽管如此,我没有成功,你可能会努力利用这些来源:

    • arch wiki - hidpi
    • 为android的Chrome设置标志 < / li>
    • 铬命号线开关列表
    • 运行Google Chrome与标志(不是来自Chrome://标志)

 

Note:

  • This answer is meant to address the bounty's note (bounty offered by Abhishek Anand) only, hence, may not be much relevant to the original-cum-historical question.

    Bounty note

    There must be a better way to [do] this. If a web server disregards user-agent value and looks at screen size, there must be a way to fake screen size too.

  • As of now, this answer is relevant only to users of Firefox Browser for Android.

Izzy's answer explains us that the issue is most likely the responsive design of the website, a design which can disregard the user-agent and ultimately, the choice of the user too.

The responsive design adjusts the UI of the website based on the dimension of the browser's window. That is, on desktop, if you open www.cs.princeton.edu/research/areas or android.izzysoft.de/articles.php (both website uses responsive design) in a new window and adjusts the size of the window using mouse or shortcuts, you will witness the transition of the design from Desktop-to-Tablet-to-Mobile.

This behavior implies that the website considers the dimensions of the browser window to be the true dimension of the screen.

In Firefox, the remedy from this behavior is to change the value of the key layout.css.devPixelsPerPx. You can do so by typing about:config in the URL bar followed by searching layout.css.devPixelsPerPx. The default would be set to -1.0. Double tap on the value to edit it.

Per Arch wiki's Firefox Tweaks and this answer by jscher2000 on Mozilla Support , changing the value to 1.0 would be equivalent to having a screen of 96 DPI (your POV may differ), a DPI often found in monitors. Tweak the value to 1.0 or 2.0 or even from a range of -1.0 to 1.0. Be very cautious when using a value to less than 1.0 on fullHD or ultraHD smartphones since the font size may become illegible.

I found 1.0 for my 5.5" fullHD decice and 0.4 for my 5.0" non-HD device the best values for Desktop mode.

Example screenshots:

  • First image: default value to -1.0
  • Second image: value to 1.0 for my fullHD device
  • Third image: value to 0.4 for my non-HD device

(Click image to enlarge)

IMG: 1 IMG: 2 IMG: 3

Drawbacks

  • The effect of the tweak is universal, hence, every site would show up in Desktop layout or the layout you chose to, until you revert the value to -1.0.
  • Some websites may rely on the user-agent too, hence changes in both may be required.

Ease for rooted devices

If you constantly need to access some particular websites with responsive design, but only in Desktop mode, to-and-fro to about:config can be pretty much tiresome.

In that case, you can use these flexible commands:

(Requires BusyBox installed)

  • Change the layout to Desktop

    am force-stop org.mozilla.firefox; sleep 1; sed -i '$auser_pref("layout.css.devPixelsPerPx", "1.0");' /data/data/org.mozilla.firefox/files/mozilla/*.default/prefs.js; monkey -p org.mozilla.firefox 1

    Here:

    • am: activity manager; is force-stopping the Firefox, otherwise, the changes wouldn't take effect
    • sleep: wait for n seconds before further execution; needed for some old and slow devices, like mine
    • sed: a stream editor; is adding the configuration that would set the layout to Desktop. 1.0 should be replaced by the value you ended up in last section.

      Note that mentioning /data/data/org.mozilla.firefox/files/mozilla/*.default/prefs.js will cause the changes to take place in every Firefox profile. To make the command profile specific, replace *.default with the name of the profile directory.

    • monkey: while meant for stress testing an app, it is helping us to launch the launcher activity of Firefox
  • Back to default mobile layout

    am force-stop org.mozilla.firefox; sleep 1;  sed -i '/.*layout.css.devPixelsPerPx.*/d' /data/data/org.mozilla.firefox/files/mozilla/*.default/prefs.js; monkey -p org.mozilla.firefox 1

    We're simply deleting the line having the layout configuration.


Real world usage

How you would practically use the two commands from last section is completely up to you.

I can recommend:

  • LMT Launcher. It has the option to assign a script to a Pie (see example). Under the script you can copy-paste the whole command. It can also assign an app shortcut to a Pie, so you can use it with Tasker or MacroDroid or Secure Settings. The latter apps can execute your commands.

  • GMD GestureControl. Use gestures to control the device, or for our case, execute our commands. For basic details and usage, see my answer here and here. You would need a third-party app like Tasker or Secure Settings for the command execution part.

  • All in one Gestures. This app can also control the device using gestures. Alike the last app, third-party support is required for command execution. If needed, see my answer for very basic info.
  • GravityBox. A magical box perhaps. You can use it to show a Pie which would execute your command on tap, or add a custom tile in the Quick Settings bar (see example). For usage, see the first section of my answer here.
  • Overlays - Float Everywhere. Reminds me of this example (Image source) where you can add stuff into a global, hidden but on-request available, sidebar. Again, you would need a third-part app to execute your commands. For usage, see the official website or my answer here.

Note:

  • The second section of this answer has its roots in the answer by g491 on Web browser - how to pass true native resolution to prevent sites from serving up mobile responsive design.
  • The website in screenshots and the app recommendations are used for demonstration purposes only. The poster is not affiliated to anything.
  • For Chrome for Android users: It maybe possible to scale the website using command-line flags. I had no success, nevertheless, you may try to make good use of these sources:

    • Arch wiki - HiDPI
    • Setting Flags for Chrome on Android
    • List of Chromium Command Line Switches
    • Run Google Chrome with flags (not from chrome://flags)
 
 
2
 
vote

某些IP块或其他报头信息可用于将请求标识为来自电话载体的请求。在尝试过度设计用户体验中,某些网站设计师可以到极端长度(例如使用此信息而不是用户代理)来强制他们认为最佳体验在用户身上。

您可以使用WiFi而不是您的移动数据计划来解决这个问题,但我怀疑这不是您要找的答案。除此之外,我知道,除了抱怨网站运营商之外,我知道你可以做到这一点。

对于它的价值,一些网站在标题或页脚中有一个链接,以允许移动用户查看标准页面(如Facebook),但这是例外而不是规则。

 

Some IP blocks or other header information can be used to identify requests as coming from phone carriers. In an attempt to over engineer the user experience, some web designers could to extreme lengths (such as using this info instead of the user agent) to force what they consider the optimal experience to be on the user.

You can get around this by using WiFi instead of your mobile data plan, but I suspect that's not the answer you're looking for. Other than that, there is zip I know of that you can do about it except complain to the website operators.

For what it's worth, some sites have a link in the header or footer to allow mobile users to view the standard page (like Facebook), but that's the exception rather than the rule.

 
 
   
   
1
 
vote

我正在使用 dolphin for pad

 

I'm using Dolphin For Pad, and it loads the desktop version of Engadget with the default settings. Won't try RedTube since it's NSFW. Give it a try! :)

 
 
1
 
vote

某些站点可以基于屏幕尺寸交换CSS。在电话分辨率下没有太多的电脑运行。禁用JavaScript可能会与Useragent更改一起工作。

 

Some sites may be swapping CSS based on screen size. There's not too many PCs out there running at phone resolutions. Disabling Javascript might work around that along with a useragent change.

 
 
 
 
0
 
vote

我在我的Android上观看了每日展会的完整发作相同的问题。事实证明我将网站作为移动到移动,不得不清除我的缓存并首先将其放在桌面模式中。

 

I had the same issue with watching full episodes of daily show on my android. Turns out I visited the site as mobile first and had to clear my cache and put it in desktop mode first.

 
 
0
 
vote

检查 Web浏览器 - 如何传递真正的本机分辨率,以防止站点服务于移动响应设计

它需要使用特定的浏览器,但至少它是一个像Firefox一样的大名称。

 

Check out the answer at Web browser - how to pass true native resolution to prevent sites from serving up mobile responsive design

It requires using a specific browser, but at least it's a big name one like Firefox.

 
 

相关问题

0  Galaxy S5股票浏览器用户代理  ( Galaxy s5 stock browser user agent ) 
我有一个问题没有检测到移动的库存S5浏览器。我不拥有一个Galaxy S5所以我问那个发现这个问题的人发给我完整的用户代理字符串,这就是我得到的: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0....

7  欺骗Firefox 4 for Android的用户代理  ( Spoof user agent in firefox 4 for android ) 
问题:有没有办法在Firefox中欺骗android的用户代理标题? 说明:让我在最长的时间使用海豚为Android使用Dolphin的事情是它可以欺骗您的用户代理标题,以便快速,轻松地避免移动暴行有些人为他们开发网站,如果我更喜欢它,仍然可以选择手动导航的选项。我没有看到这个选项,以获得Android的最新版本...

5  根据网站更改浏览器用户代理的方法  ( Method to change browser user agent based on site ) 
Dolphin浏览器可以配置为充当一系列用户代理(Android,(完整)桌面,其他手机......)。但这是针对您访问的每个站点,直到要将设置更改为其他代理(浏览器类型)。 一些网站比其他网站更好。 我想知道这个或另一个Android浏览器上有一个功能/插件,可以单独设置代理的范围某些站点,例如: facebo...

0  Galaxy S5股票浏览器用户代理  ( Galaxy s5 stock browser user agent ) 
我有一个问题没有检测到移动的库存S5浏览器。我不拥有一个Galaxy S5所以我问那个发现这个问题的人发给我完整的用户代理字符串,这就是我得到的: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0....

24  如何更改股票浏览器的用户代理?  ( How can i change the user agent for the stock browser ) 
我不断恼火,这些网站强迫我进入网站(通常可怕)的移动版本,并没有提供切换到完整版本的方法。我知道Dolphin允许将浏览器的用户代理字符串更改为欺骗网站,以提供完整的网站,但我不想切换。有没有办法使用股票浏览器?我对黑客开放,我有一个Galaxy S充满活力的运行2.2(Nero V5带TouchWiz)。 ...

7  如何强制加载桌面版本的网站(更改用户 - 代理不起作用)?  ( How to force load desktop version of website changing user agent doesnt work ) 
某些网页强制移动版本甚至我更改了用户代理。 我在内置浏览器中更改了User-Agenter和"Dolphin浏览器HD" , 我在页面www.user-agent-string.info 上检查它 主要问题是Engadget.com,始终在移动版中。 我试图清洁cookie,重启浏览器等。 这是我的结果: 在内置浏...

1  Android 4.0 - 任何能够设置UserAgent的浏览器?  ( Android 4 0 any browser able to set useragent ) 
是有没有在android 4.0上运行的浏览器(或其加载项),其中我可以调整useragent字符串? 我想使用旧的Android设备在浏览器中查看Microsoft待办事项列表。但他们显然有Android版本检查,因为它们只显示旧OWA(Outlook Web Access)接口。 已测试的应用程序: 三星互...




© 2022 it.wenda123.org All Rights Reserved. 问答之家 版权所有