-
Notifications
You must be signed in to change notification settings - Fork 81
MS Edge compatibility #103
base: 1.0
Are you sure you want to change the base?
Conversation
…to ms-edge # Conflicts: # manifest.json
// MS Edge support | ||
if (!chrome.webRequest) { | ||
chrome.webRequest = browser.webRequest; | ||
} |
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 this is the best polyfill because of this compat weirdness:
- Edge defines
window.chrome
already, but notchrome.webRequest
. - Edge defines
browser.webRequest
as callback-based. - Firefox defines
chrome.webRequest
as callback-based andbrowser.webRequest
as Promise-based. - Chrome defines
chrome.webRequest
as callback-based and does NOT definebrowser.webRequest
.
So I could not directly use browser.webRequest
because Chrome does not have it and Firefox implements it differently. I also could not do the single-line chrome.webRequest = chrome.webRequest || browser.webRequest
because Chrome evaluates both expressions and errors out.
"version": "1.0", | ||
"description": "This extension will mangle your browser's requests to maximize the chances of bypassing paywalls.", | ||
"permissions": ["webRequest", "webRequestBlocking", "*://*/*"], | ||
"background": { | ||
"scripts": ["background.js"] | ||
"scripts": ["background.js"], | ||
"persistent": 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.
background.persistent
is required for Edge. Chrome says to use false
for background scripts (and I assume this is default).
Firefox outputs this warn message upon side-loading, but otherwise the extension works fine. It comes across as an error, but is actually a warn. See Bugzilla issue on changing this message. I don't think this affects the user install experience, but I'm unfamiliar with that process.
Edge extension packaging works. See test package: anti-paywall-9044fce.zip I followed the instructions here:
For submission, you would need to provide the app icon at 44x44, 50x50, and 150x150. You would also need to sign up with Windows Dev Center and input the supplied Identity keys in the packaging step. See first link for more details. |
Closes #34. Edge loads this extension with the following changes:
manifest.json
: Addauthor
fieldmanifest.json
: Addbackground.persistent = false
background.js
: Definechrome.webRequest
by pointing tobrowser.webRequest
It sideloads and works fine in all three browsers.
Packaging and submission info is here;
I haven't looked into this personally.(edit: see comment, it works)