Closed Bug 1457335 Opened 2 years ago Closed 2 years ago

histography.io - Override UA & navigator.vendor

Categories

(Web Compatibility :: Interventions, enhancement)

enhancement
Not set

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: adamopenweb, Assigned: denschub)

References

Details

(Whiteboard: [sitepatch-built])

Attachments

(1 file)

Originally filed: https://github.com/webcompat/web-bugs/issues/1804

The site doesn't allow Firefox and contacts have not been successful. It is ranked 285,224 in the U.S, which isn't very high but it would be good for this site to actually work for Firefox users.

Detection code:
var nt = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor),
        at = /Safari/.test(navigator.userAgent) && /Apple Computer/.test(navigator.vendor),
        it = /Safari/.test(navigator.userAgent) && /Googlebot/.test(navigator.vendor),
        rt = {
            Android: function() {
                return navigator.userAgent.match(/Android/i)
            },
            BlackBerry: function() {
                return navigator.userAgent.match(/BlackBerry/i)
            },
            iOS: function() {
                return navigator.userAgent.match(/iPhone|iPad|iPod/i)
            },
            Opera: function() {
                return navigator.userAgent.match(/Opera Mini/i)
            },
            Windows: function() {
                return navigator.userAgent.match(/IEMobile/i)
            },
            any: function() {
                return rt.Android() || rt.BlackBerry() || rt.iOS() || rt.Opera() || rt.Windows()
            }
        };
    rt.any() && (window.location = "mobile.htm"), nt || at || it || (window.location = "browser_support.htm");

Since we do not support navigator.vendor, I'm guessing we'll need to inject JS to override.
Attached patch Pull Request #23Splinter Review
This PR implement a UA override, so Firefox users can enjoy the site as well!
Attachment #8988660 - Flags: review?(wisniewskit)
Assignee: nobody → dschubert
Comment on attachment 8988660 [details] [diff] [review]
Pull Request #23

Review of attachment 8988660 [details] [diff] [review]:
-----------------------------------------------------------------

r+ (notes on GitHub)
Attachment #8988660 - Attachment is patch: true
Attachment #8988660 - Attachment mime type: text/x-github-pull-request → text/plain
Attachment #8988660 - Flags: review?(wisniewskit) → review+
Blocks: 1481395
Site patch is landed in our repo on GitHub, so this can be closed. Landing the site patches (and eventually updating Release users via GoFaster) is tracked in 1481395.
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
FYI The site is broken again even with the user agent override.
See https://webcompat.com/issues/20523 for new diagnosis.
Whiteboard: [sitepatch-built]
You need to log in before you can comment on or make changes to this bug.