Created
September 8, 2012 09:34
-
-
Save coderaiser/3673049 to your computer and use it in GitHub Desktop.
Bookmarklet for download any web page file from links thru drag'n'drop
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
/* Add bookmark with this link | |
* on web page would be dragable and you can | |
* drag it to desktop | |
*/ | |
javascript:for(var lLinks=document.getElementsByTagName("a"),i=0;i<lLinks.length;i++)lLinks[i].ondragstart=function(a){lElement=a.target;a.dataTransfer.setData("DownloadURL","application/octet-stream:"+lElement.textContent+".html:"+lElement.href)}; |
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
var lLinks = document.getElementsByTagName('a'); | |
for(var i=0; i < lLinks.length;i++){ | |
lLinks[i].ondragstart = function(pEvent){ | |
lElement = pEvent.target; | |
pEvent.dataTransfer.setData("DownloadURL", | |
'application/octet-stream' + ':' + | |
lElement.textContent + '.html' + ':' + | |
lElement.href); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment