Chào mọi người.
Chúc các bạn một ngày làm việc hiểu quả.Bài viết này mình muốn chia sẽ đến mọi người một đoạn
Javascript
tự động Get link download Google Drive
trong bài viết mà mọi người không cần phải bỏ Link share
từ Google Drive
ở trang ngoài để lấy link nữa.
Link tải xuống tự động của Google Drive
.
Mọi người bỏ đoạn code bên dưới vào trên thẻ </body>
hoặc <!--</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", "").replace("/view?usp=share_link", ""); }); /*]]>*/</script>
Như vậy đã hoàn thành, chúc mọi người thành công.
Bên dưới là link demo.