Project

General

Profile

Actions

Feature #767

closed

Is there any way to force desktop view?

Added by Neon Robot over 2 years ago. Updated 9 months ago.

Status:
Closed
Priority:
3.x
Start date:
10/04/2021
Due date:
% Done:

0%

Estimated time:

Description

...page and changing user agent don't do anything. If page opened as mobile version, it can't be switched to desktop one. For example in Firefox such feature works.

Or i am missing something?


Files

Responsive Design.png (925 KB) Responsive Design.png Soren Stoutner, 10/05/2021 01:50 PM
Actions #1

Updated by Soren Stoutner over 2 years ago

  • Assignee set to Soren Stoutner

The answer to that question depends entirely on how the website determines when to send a desktop view. For example, a few websites use the width of your screen to determine if they should send a desktop view. Firefox has the ability to lie to the website about the width of the screen and does so in their Desktop Mode. Android's WebView does not provide that functionality (although that is a planned feature for Privacy WebView).

What is an example of a website where Firefox can display a desktop view and Privacy Browser cannot?

Actions #2

Updated by Neon Robot over 2 years ago

Neon Robot wrote:

...page and changing user agent don't do anything. If page opened as mobile version, it can't be switched to desktop one. For example in Firefox such feature works.

Or i am missing something?

For eg. this site:
https://trackerninja.codeberg.page/

Actions #3

Updated by Soren Stoutner over 2 years ago

I think it is important to distinguish between two related ideas that are sometimes conflated.

1 - Some websites have two different versions of the website, one that they send to desktop browsers and another that they send to mobile browsers. When you make a request to the webserver, it analyzes the request and makes a determination as to which version of the website it will send in response. Based on whatever criteria the webserver uses to decide, you will receive different HTML, CSS, and JavaScript responses. This is known as adaptive web design:

https://en.wikipedia.org/wiki/Adaptive_web_design

Wikipedia is an example of a website that does this. In this case, the purpose of a desktop mode is to convince the webserver to send different HTML, CSS, and JavaScript files to the browser.

2 - Other websites send the same HTML, CSS, and JavaScript to all browsers. The are built using adaptive design, where the HTML, CSS, and JavaScript adjust the layout in a way where it makes sense on any screen size. This is known as responsive web design.

https://en.wikipedia.org/wiki/Responsive_web_design

trackerninja.codeberg.page is an example of this. In this case, the purpose of a desktop mode is to convince the HTML renderer to layout the HDML, CSS, and JavaScript files differently. It often does this by lying about the true width of the screen to make it layout more like the desktop.

As mentioned above, Android's WebView does not currently provide a way to lie about the width of the screen. But, it is a planned feature for Privacy WebView.

https://redmine.stoutner.com/issues/233

You can verify that trackerninja.codeberg.page is using responsive web design and that it lays out the same as it does in Firefox in "Desktop Mode" by viewing it in Privacy Browser on a device with a larger screen (see attached screenshot).

Actions #4

Updated by Neon Robot over 2 years ago

Soren Stoutner wrote:

I think it is important to distinguish between two related ideas that are sometimes conflated.
You can verify that trackerninja.codeberg.page is using responsive web design and that it lays out the same as it does in Firefox in "Desktop Mode" by viewing it in Privacy Browser on a device with a larger screen (see attached screenshot).

Thank you for such a detailed answer!
And anyways, it will be neat to see such feature in a future version of Privacy Browser.

Actions #5

Updated by ask low 9 months ago

The most probable and simple way I found, is to rotate into landscape mode. Works on almost all the websites.

Actions #6

Updated by Soren Stoutner 9 months ago

Sometimes that works. It depends on if a web server is using the screen width to decide if it will send you the desktop or mobile version.

Actions #7

Updated by ask low 9 months ago

I don't think the width check decides desktop mode or mobile mode, as there's no reloading occurs when you rotate into landscape mode. Such sites just seem to adapt the page into desktop layout without even reloading.
Seems like we already parse their pages written for both widths by advance.

Actions #8

Updated by Soren Stoutner 9 months ago

In some cases the page does change to match the layout (what is known as Responsive Web Design, see the link in comment 3 above). In other cases, the server actually sends different versions of web pages to different devices (what is known as Adaptive Web Design, also linked in comment 3 above). If a web server uses Adaptive Web Design, they can use any criteria they like to decide which version of the web page to send you. Some of them use screen width and others don't.

Note that when web servers do have different versions of webpages for mobile and desktop, the single biggest factor they often user to decide what to send you is the user agent. Privacy Browser's user agent is generally identified as a desktop, so it often gets the desktop version. However, depending on how that desktop version was coded, it might not layout well on a portrait phone screen. In that case, switching to landscape can improve the layout. But that is a different topic than getting a web server to send you a desktop version if it is currently sending you a mobile one.

There is some more information about user agent in the Guide inside the app and at https://www.stoutner.com/user-agent-problems/.

Actions

Also available in: Atom PDF