-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Show error page on firefox v49 and below #339
Conversation
frontend/src/common.js
Outdated
gcmCompliant().catch(err => { | ||
$('#page-one').attr('hidden', true); | ||
$('#download').attr('hidden', true); | ||
sendEvent('sender', 'unsupported', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Below this was "recipient" in /frontend/src/download.js (but "sender" in the upload.js).
Is this fine here as "sender" always?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's not. Good catch, we might have to take this out of common.js.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, yeah, didn't see that
frontend/src/common.js
Outdated
if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 && | ||
parseInt(navigator.userAgent.toLowerCase().match(/firefox\/*([^\n\r]*)\./)[1]) <= 49) { | ||
sendEvent('sender', 'unsupported', { | ||
cd6: 'Unsupported Firefox' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this fine as a string?
In every other instance of cd6
I grepped, the cd6
was an error object.
Disclaimer: I know nothing about metrics collection.
Do you think we should keep it in |
I like not having to repeat the code twice, but then it does add an extra step to figure out which page. |
I've added a check in common to address this, let me know what you think. |
7b0d2dc
to
cfd88a9
Compare
Semi related, but do we want to do similar UA sniffing and redirect IE users to /unsupported? |
@pdehaan yeah, that's my plan at least |
@SoftVision-CiprianMuresan can you test on IE for me to ensure that it is being redirected to the unsupported page? Also, should we block Edge as well, or just some versions of it. If so, which versions? |
d10a9dc
to
78b857c
Compare
@@ -67,6 +67,8 @@ expiredPageHeader = This link has expired or never existed in the first place! | |||
notSupportedHeader = Your browser is not supported. | |||
// Firefox Send is a brand name and should not be localized. | |||
notSupportedDetail = Unfortunately this browser does not support the web technology that powers Firefox Send. You’ll need to try another browser. We recommend Firefox! | |||
notSupportedOutdatedDetail = Unfortunately this version of Firefox does not support the web technology that powers Firefox Send. You’ll need to update your browser. | |||
updateFirefox = Update Firefox |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/cc @flodolo since this adds some l10n strings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Feel free to use the testpilot solution to ping automatically ;-)
https://github.com/mozilla/testpilot/blob/master/CODEOWNERS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, I just learnt something new today!
Filed as #343, which I can create a PR for shortly.
server/server.js
Outdated
app.get('/unsupported', (req, res) => { | ||
res.render('unsupported'); | ||
app.get('/unsupported/:reason', (req, res) => { | ||
const outdated = req.params.reason === 'outdated'? true : false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the ? true : false
sorcery is unnecessary here since req.params.reason === 'outdated'
should be Boolean-enough(tm).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true
</div> | ||
</a> | ||
{{#if outdated}} | ||
<div class="description" data-l10n-id="notSupportedOutdatedDetail"></div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re: notSupportedOutdatedDetail = Unfortunately this version of Firefox does not support the web technology that powers Firefox Send. You’ll need to update your browser.
Then below you send me to a SUMO page. It may be more useful to send users right to the Firefox download page here. :unsolicted_advice:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but the users already have firefox...they just need to know how to update it
views/unsupported.handlebars
Outdated
</a> | ||
{{#if outdated}} | ||
<div class="description" data-l10n-id="notSupportedOutdatedDetail"></div> | ||
<a id="update-firefox" href="https://support.mozilla.org/az/kb/update-firefox-latest-version"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm reading this correctly, we're sending everybody to the Azerbaijani (az) locale of the page. We may just want to neuter the /az/
portion of the URL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should definitely be https://support.mozilla.org/kb/update-firefox-latest-version
frontend/src/common.js
Outdated
if (navigator.userAgent.toLowerCase().indexOf('msie') > -1 || | ||
navigator.userAgent.toLowerCase().match(/trident\/7\./)) { | ||
window.location.replace('/unsupported/ie'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before we go too far down a UA+regex abyss, not sure if we want to consider something like https://github.com/faisalman/ua-parser-js maybe.
https://www.npmjs.com/package/ua-parser-js#using-jqueryzepto-ua
const UAParser = require('ua-parser-js');
const parser = new UAParser();
const uaBrowser = parser.getResult().browser;
console.log(uaBrowser); // { name: "Firefox", version: "55.0", major: "55" }
UPDATE: A bit more verbose than I was hoping for, but it reads OK-ish. Pseudo-code ahoy!
const UAParser = require('ua-parser-js');
const uaBrowser = new UAParser().getResult().browser;
const isSender = !location.pathname.includes('/download');
const senderOrRecipient = isSender ? 'sender' : 'recipient';
gcmCompliant().catch(err => {
sendEvent(senderOrRecipient, 'unsupported', {
cd6: err
})
window.location.replace('/unsupported/gcm');
});
checkUserAgent(uaBrowser, senderOrRecipient);
function checkUserAgent(browser, type) {
const majorVersion = parseInt(browser.major, 10);
switch (browser.name.toLowerCase()) {
case 'firefox':
if (majorVersion <= 49) {
sendEvent(type, 'unsupported', {
cd6: new Error('Firefox is outdated.')
});
location.replace('/unsupported/outdated');
return;
}
break;
case 'explorer': // NOTE: I made this value up.
location.replace('/unsupported/ie');
break;
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a huge fan of including npm modules for everything that seems like overkill. I'm open to it, but the regex is already written and really not a big problem, I don't see too many more UA checks being added in...
frontend/src/common.js
Outdated
|
||
if (navigator.userAgent.toLowerCase().indexOf('msie') > -1 || | ||
navigator.userAgent.toLowerCase().match(/trident\/7\./)) { | ||
window.location.replace('/unsupported/ie'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a sendEvent()
here (before the location.replace()
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea. @abhinadduri would you like a different event, or the same event as gets sent for outdated firefox?
@ericawright, using a local server I've run branch v49 on a Mac and connected remotely from my Windows machine. It does, however, work on Firefox 49 and lower. And to answer your other question, in my opinion we should only block Microsoft Edge v.25.10586.672.0 . The other two versions of Edge work as expected (see Cosmin's comment in #127). |
@SoftVision-CiprianMuresan @dannycoates @pdehaan (and others) we have some options to deal with IE. what's happening is that it doesn't support ES6. And it errors in our scripts then fails to run any part of them. So @dnarcese and I have come up with a few solutions.
1 is easier, but we may end up never supporting IE if we go that route. |
I think +1 to using babel to transpile to ES5 for maximum compatibility (although we'd still need GCM support, so we wouldnt get that much compatibility from older browsers anyways). Also, while trying to hack on UA options yesterday, I found https://github.com/biggora/express-useragent. Maybe we can just detect the IE browsers using Express middleware on the servers and do the redirect there for your option 1. Then it can easily use a custom layout if needed. |
@SoftVision-CiprianMuresan Any chance you can send us your IE user agent string: http://www.whatismyuseragent.net/? |
@SoftVision-CiprianMuresan I guess of you have a UserAgent string for that too, it would be helpful. |
Here's my Edge user-agent: And my IE one is: |
Well, the IE one would fail, because the RegExp works for +if (navigator.userAgent.toLowerCase().indexOf('msie') > -1 ||
+ !!navigator.userAgent.toLowerCase().match(/trident\/7\./)) {
+ window.location.replace('/unsupported/ie');
+} UPDATE: I take that back... re-reading your |
@pdehaan this is true. I'll find another way to identify IE (outside of IE11) |
we're struggling with babelify. Since @dannycoates talked about doing a new release today, maybe we merge this without the IE changes. Then either get babelify working or do a last minute fix using option one from above.
Yes, the 'msie' check is for IE < 11, and the 'trident' check is for IE11 |
I was starting to look into replacing browserify with webpack the other day, but then got side tracked by other projects... If I have a few minutes today I may see if I can get a basic webpack config+minification working, then try adding in babel into the stack-of-doom. |
But I'm 👍 for merging whatever we have, and filing new bugs for sorting out the older IE issues in a future bug/PR. I really thought IE would have been caught by the GCM check anyways. But maybe that's an issue w/ the promise being async and it trying to run the UA regexes before the GCM check has had a chance to fail out. Or something else entirely. |
It seems that because of the ES6 syntax, IE just gives up and doesn't run anything if there is any ES6 syntax anywhere in the file. So the GCM check might have otherwise caught on it. it's the same with the redirect I'm trying to do. the code is correct. and will run in the console, but it sees the file as being corrupted. |
Ok, I took out the IE code. So it's ready for review from whoever would like to give one :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Submitted new bug to re-add IE detection code: #351 "Redirect IE users to an /unsupported/ie page". |
@abhinadduri can you create an appropriate GA event for this?
Everyone else, any opinions on what should be shown on this page?
/unsupported/outdated now looks like this:

very similar to /unsupported/gcm
link goes to "https://support.mozilla.org/kb/update-firefox-latest-version" which offers advice on how to update firefox
Fixes: #319.
Ref: #127.