Google Drive Link Generator with direct download link through JavaScript

 




Hello & Assalaam o aleykum Dear all on this occasion I will share how to make a google drive link a direct download with javascript.

in my previous post, I have shared the google drive generator tool to convert the google drive share link into a direct download link.

The Plan is that I will share this time is that it will automatically change all Google Drive share links that are in the anchor tag into direct download links without having to use a generator again. it will work like magic

Just copy the Javascript below and place it above the code </body> or <!--</body>--></body>

<script>/*<![CDATA[*/
var anchorDrive = document.querySelectorAll('a[href*="drive.google.com"]');
Array.prototype.forEach.call(anchorDrive, function(element, index) {
    element.href = element.href.replace("/file/d/", "/uc?export=download&id=").replace("/view?usp=sharing", "");
});
/*]]>*/</script>

So Now that is all The direct download google drive links with javascript that I can share this time, hopefully it's useful and thank you for visiting.



Post a Comment

Previous Post Next Post
Marwat Tech

let's build a community