Android icon indicating copy to clipboard operation
Android copied to clipboard

Desktop site feature loads mobile layout

Open Johennes opened this issue 5 years ago • 9 comments

Experiencing this on 5.49.1 mg (54901).

URL: https://stackoverflow.com/questions/tagged/swift

Layout in DuckDuckGo:

Screenshot_20200407-212159

Layout in Firefox:

Screenshot_20200407-212217

Note that DuckDuckGo loads the desktop site but laid out responsively for a mobile viewport. I think this might not be intended because some responsive sites hide parts of the UI and trim down features on smaller screens.

Johennes avatar Apr 07 '20 19:04 Johennes

Thanks for reporting the issue, I was able to reproduce this issue on my device. I will take a look to see if I can see where the issue is coming from. 👍

cmonfortep avatar Apr 15 '20 12:04 cmonfortep

Interestingly I see it on the DDG iOS app as well. I was wondering if maybe the particular user agent string you use might influence it but I'm not seeing any apparent differences to what Firefox uses on a glance.

Johennes avatar Apr 15 '20 13:04 Johennes

Here is some evidence of what Firefox seems to be doing: https://hg.mozilla.org/mozilla-central/file/tip/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSessionSettings.java#l219

    /**
     * Mobile-friendly pages will be rendered using a viewport based on their <meta> viewport
     * tag. All other pages will be rendered using a special desktop mode viewport, which has a
     * width of 980 CSS px.
     */
    public static final int VIEWPORT_MODE_MOBILE = 0;

    /**
     * All pages will be rendered using the special desktop mode viewport, which has a width of
     * 980 CSS px, regardless of whether the page has a <meta> viewport tag specified or not.
     */
    public static final int VIEWPORT_MODE_DESKTOP = 1;

Johennes avatar Apr 16 '20 16:04 Johennes

I've been able to showcase a potential fix using a user script to force a larger viewport in https://github.com/duckduckgo/iOS/issues/624.

Johennes avatar Apr 16 '20 20:04 Johennes

Thanks for the write up and the investigation @Johennes . I will align with the iOS team and discuss about a possible fix.

cmonfortep avatar Apr 17 '20 16:04 cmonfortep

Hi @Johennes, we discussed this issue internally and decided to do a quick investigation. Depending on the complexity of the fix we will prioritize the task. In any case, we will report here if we find any proposed solution in case someone wants to bring a contribution.

Additionally, If anyone wants to bring a proposal, we are open to discuss it here too :)

cmonfortep avatar Apr 21 '20 15:04 cmonfortep

I am not proficient in Android development but what seemed to work well on iOS in my testing was to add a content script that modifies / inserts the view port meta header to force the size (see the snippet in https://github.com/duckduckgo/iOS/issues/624). I couldn't find another way of forcing the view port on WKWebView. I suppose theoretically this should work on Android as well but unsure if Android maybe has better APIs to do this without JS hacking.

Johennes avatar Apr 21 '20 19:04 Johennes

no problem @Johennes, I was just being explicit that we are open to receiving any proposals from contributors. You already did a good effort here and we highly appreciate the feedback you brought us.

I logged our technical exploration internally: https://app.asana.com/0/414730916066338/1172939626954562/f

cmonfortep avatar Apr 27 '20 06:04 cmonfortep

Desktop Site toggle basically never works on most sites, tbh. The same happens with LineageOS's default browser though (Jelly), so it could just be a webview limitation rather than a duckduckgo bug. I don't know of any other webview-based browsers that have desktop view toggle that I can try though.

ghost avatar May 08 '21 18:05 ghost

Duplicated.

malmstein avatar Jun 23 '23 09:06 malmstein