Closed Bug 1109675 Opened 5 years ago Closed 4 years ago

Implement 'Request Desktop Site'

Categories

(Firefox for iOS :: Browser, defect)

All
iOS 9
defect
Not set

Tracking

()

VERIFIED FIXED
Tracking Status
fxios 2.0+ ---

People

(Reporter: st3fan, Assigned: johannesmarbach)

References

Details

(Whiteboard: [ios9][needstrings])

Attachments

(2 files, 1 obsolete file)

Find out if we can do the 'Request Desktop Site' thing that Safari has.

(Assuming that is something we will want.)
It is possible. Placing the following code in AppDelegate will allow you to change the user agent. (I don't know if this is the best or only way)

NSUserDefaults.standardUserDefaults().registerDefaults(["UserAgent" : "Custom Agent"])

for example I can load the Facebook desktop site like this:

NSUserDefaults.standardUserDefaults().registerDefaults(["UserAgent" : "Macintosh; Max OS 10_10"])
Aaron this is a good method to globally change the user agent. I'm not sure if it is the best way to go for Request Desktop Site though since we cannot do this per tab. Would you mind doing an experiment to see if we can change this value for individual WKWebView instances?

(In reply to Aaron Raimist [:aaronraimist] from comment #1)
> Created attachment 8539821 [details]
> User agents from Safari and Chrome on iOS
> 
> It is possible. Placing the following code in AppDelegate will allow you to
> change the user agent. (I don't know if this is the best or only way)
> 
> NSUserDefaults.standardUserDefaults().registerDefaults(["UserAgent" :
> "Custom Agent"])
> 
> for example I can load the Facebook desktop site like this:
> 
> NSUserDefaults.standardUserDefaults().registerDefaults(["UserAgent" :
> "Macintosh; Max OS 10_10"])
Flags: needinfo?(aaronraimist)
tracking-fennec: --- → ?
tracking-fennec: ? → -
Summary: Find out if we can do the 'Request Desktop Site' thing that Safari has → Implement 'Request Desktop Site'
Depends on: 1173383
Flags: needinfo?(aaronraimist)
OS: Mac OS X → iOS 9
Hardware: x86 → All
Whiteboard: ios9
Depends on: 1206204
Depends on: 1210124
Attached patch desktop-only.diff (obsolete) — Splinter Review
Since this ticket is targeting iOS9, we could simply take advantage of WKWebView's customUserAgent property. The attached patch is meant as a prrof of concept and applies a custom user agent of "Macintosh; Max OS 10_10" to each newly created tab which forces all content to be loaded in the desktop representation.
tracking-fennec: - → ---
Are there any UI mocks for how to opt in and out of desktop mode?
Flags: needinfo?(sarentz)
Comment on attachment 8681865 [details] [diff] [review]
desktop-only.diff

Just making sure some set of eyes sees this as I believe it's on a roadmap.
Attachment #8681865 - Flags: feedback?(bnicholson)
Thank you Hennes. Please ask :bnicholson for a review. He has this feature on his personal roadmap but I am sure he would happily work with you if you are interested in taking this on.

Do know that we are still in the process of figuring out where the button should go. The UX team is experimenting with a place for 'tools' where things like Request Desktop Site and Find In Page can live.

So this bug may be on hold for a little while until we figure that part out.
Flags: needinfo?(bnicholson)
Flags: needinfo?(sarentz)
Flags: needinfo?(bnicholson)
Comment on attachment 8681865 [details] [diff] [review]
desktop-only.diff

Hi Hennes,

When we last talked about this feature, I think the UX was to long-press the reload button to reload the current page with a desktop UA (what Safari does). I think the only visible UI was simply a small bar that floats right above the bottom toolbar that says "Request Desktop Site", which appears after the long press, and disappears when the user lets go. I think Darrin had mockups for this.

For now, a good start would be to simply implement this without any UI. That is, reload with the desktop UA after long-pressing the reload button, then reset the UA to mobile whenever the user navigates away from that page.
Flags: needinfo?(dhenein)
Attachment #8681865 - Flags: feedback?(bnicholson) → feedback+
Attached file Pull request
Hi Brian,

Thanks a lot for the info. I got a basic version of what you described working in this pull request. I also have a few follow-up questions that I added in the comments of the pull request.
Attachment #8682082 - Flags: review?(bnicholson)
Attachment #8681865 - Attachment is obsolete: true
Assignee: nobody → johannesmarbach
Status: NEW → ASSIGNED
Comment on attachment 8682082 [details] [review]
Pull request

Looking good! Left a few comments in the PR.
Attachment #8682082 - Flags: review?(bnicholson) → feedback+
I think for now we want to just use a system action sheet, with one primary action ("Request Desktop Site" or "Request Mobile Site") and a system Cancel item. We lose the one gesture (long-press and then release) for two taps (long-press then tap sheet item) but I think this is fine for now.

Let me know if there are any questions.
Flags: needinfo?(dhenein)
I added the action sheet toggling to the PR.
See also Bug 1222423, which is worth testing for our iOS implementation.
See Also: → 1222423
(In reply to Richard Newman [:rnewman] from comment #12)
> See also Bug 1222423, which is worth testing for our iOS implementation.

I was actually already able to work this out with Brian's help. The web view gives us access to the initial unredirected URL of a page which we use for requesting the desktop (or mobile) presentation.
Attachment #8682082 - Flags: feedback+ → review?(bnicholson)
Comment on attachment 8682082 [details] [review]
Pull request

This looks great...thanks for all your work so far! Left a few suggested cleanup comments in the PR, but I think this is about ready to land.
Attachment #8682082 - Flags: review?(bnicholson) → feedback+
Comment on attachment 8682082 [details] [review]
Pull request

Awesome, thanks a ton for the patch and all of the follow-up fixes! :)
Attachment #8682082 - Flags: feedback+ → review+
https://github.com/mozilla/firefox-ios/commit/47c076d002f2d15bd5a88c1e9305039b5f6485d8
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Tested via http://nytimes.com on iPhone/iPad
Status: RESOLVED → VERIFIED
Depends on: 1228547
Backed out v1.x (7ed4b63) due to bug 1228547.
Re-uplifted to v1.x: b4f1ab1e
Target Milestone: --- → 1.3
Depends on: 1230504
Depends on: 1230567
Whiteboard: ios9 → [ios9][needs strings]
Whiteboard: [ios9][needs strings] → [ios9][needstrings]
See Also: → 1236887
Blocks: 1210124
Depends on: 1240057
No longer depends on: 1210124
You need to log in before you can comment on or make changes to this bug.