Last active
May 1, 2019 13:40
-
-
Save unixfox/e8628ed8cdeb44c6adcf1d41587dabe8 to your computer and use it in GitHub Desktop.
Firefox web extension that enable a proxy if on mobile/cellular network
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (navigator.connection.type === "cellular") { | |
browser.proxy.register( | |
"pac.js" | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"description": "Switching proxy if on mobile network", | |
"manifest_version": 2, | |
"name": "mobileproxy", | |
"version": "0.1", | |
"icons": { | |
"48": "proxy.png" | |
}, | |
"permissions": [ | |
"NetworkInformation", | |
"proxy" | |
], | |
"background": { | |
"scripts": [ | |
"background.js" | |
] | |
}, | |
"browser_specific_settings": { | |
"gecko": { | |
"id": "contact@email.com" | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function FindProxyForURL(url, host) { | |
if (url.substring(0, 5) == 'http:' || url.substring(0, 6) == 'https:') { | |
return "HTTP 127.0.0.1:8080"; | |
} | |
return "DIRECT"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment