YouTube-Download icon indicating copy to clipboard operation
YouTube-Download copied to clipboard

Javascript code is too long to create a bookmark in IE11

Open agret opened this issue 11 years ago • 2 comments

The bookmark URL field cuts off at >Download('+numOfLi - the code is simply too long to fit into an IE11 bookmark. Not sure if it's possible to create a condensed version for bookmarklet use rather than extension use.

image

Edit: Seems like a better solution would be to create a small piece of javascript that loads the main javascript from githiub into the page.

agret avatar Feb 05 '14 00:02 agret

Thanks @agret for letting me know. The code could certainly be shortened as I wrote it when I first learned programming, but I didn't pay attention to its length at the time because it was working on Safari, FF and GC.

Your suggestion seems perfect. I'll see how'd this work as soon as I have the time. In the mean time, could you please report the maximum length possible for IE11?

motasay avatar Feb 05 '14 13:02 motasay

5120 Characters is the bookmark URL length for IE11.

See http://www.deturl.com/bookmarklet-to-directly-download-videos-from-youtube.asp for an example of using some proxy code to load a JS into YouTube

(Copy-paste of their bookmarklet)

javascript:(function(w,d){var jloaded=false,jsrc='download-video.js',fsrc='http://deturl.com/iframelet.html?js='+encodeURIComponent(jsrc),l=window.location.href;function msg2js(e){if(e.origin=='http://deturl.com'){jloaded=true;var js=document.createElement('script');js.type='text/javascript';js.textContent=e.data;document.body.appendChild(js);window.removeEventListener('message',arguments.callee)}}if(w.addEventListener)w.addEventListener('message',msg2js,false);else w.attachEvent('onmessage',msg2js);var f=d.createElement('iframe');f.src=fsrc;f.style.cssText='display:none;';d.body.appendChild(f);if(l.match(/^https:/i)){window.setTimeout(function(){if(!jloaded){if(confirm('The bookmarklet can not be run on HTTPS pages in this browser.\n\nGo to the regular HTTP version of this page?')){window.location.href=l.replace(/^https:/i,'http:')}else{window.location.href='http://deturl.com/?bt&url='+encodeURIComponent(l)}}},5000)}})(window,document);

agret avatar Feb 06 '14 22:02 agret