Created
August 26, 2015 15:20
-
-
Save ahvonenj/92b260440af43609fa5d to your computer and use it in GitHub Desktop.
Chrome web store download
This file contains hidden or 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
/* | |
* @title crx DL link | |
* @description prompt crx download-link on Chrome Web Store | |
* @include https://chrome.google.com/webstore/detail/* | |
* @contributor taizooo http://let.hatelabo.jp/taizooo/let/gYC-x-e5r_G0bw (Fork of) | |
* @contributor noromanba http://let.hatelabo.jp/noromanba/let/hLHX5-ST-aMn | |
* @license MIT License http://opensource.org/licenses/MIT | |
* @javascript_url | |
*/ | |
// http://stackoverflow.com/questions/7184793/how-to-download-a-crx-file-from-the-chrome-web-store-for-a-given-id | |
// http://0-9.tumblr.com/post/52782603407/chrome-extension-development-casual | |
(function () { | |
// http://let.hatelabo.jp/noromanba/let/hLHVzOTQjfYH | |
var canonical = function () { | |
var url = (document.head.querySelector('meta[property="og:url"][content]') || {}).content || | |
(document.head.querySelector('link[rel="canonical"][href]') || {}).href || | |
location.href; | |
// https://developer.mozilla.org/en-US/docs/Web/API/URL | |
// https://developer.mozilla.org/en-US/docs/Web/API/URL.URL | |
return new URL(url); | |
}; | |
var id = canonical().pathname.split('/').filter(function (s) { return !!s; } ).pop(); | |
var link = [ | |
// can use https | |
'http://clients2.google.com/service/update2/crx?response=redirect&x=id%3D', | |
id, | |
'%26uc', | |
// 32 or higher e.g. 33, 64. OBSOLETE "&prod=chrome" | |
'&prodversion=32' | |
].join(''); | |
prompt('Copy Me', link); | |
})(); | |
// dev-doc https://gist.github.com/noromanba/5776183 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment