Press This Bookmarklet too many characters for Edge Browser
-
The ‘Press This’ Bookmarklet Javascript has about 20 more characters than what the Edge Browser link field allows. It truncates in the middle of the http at the end.
Can someone edit the script to make it shorter without taking out too many functions? Images would be the best option to delete.
Thanks
javascript:(function(a,b,c,d){function e(a,c){if(‘undefined’!=typeof c){var d=b.createElement(‘input’);d.name=a,d.value=c,d.type=’hidden’,p.appendChild(d)}}var f,g,h,i,j,k,l,m,n,o=a.encodeURIComponent,p=b.createElement(‘form’),q=b.getElementsByTagName(‘head’)[0],r=’_press_this_app’,s=!0;if(d){if(!c.match(/^https?:/))return void(top.location.href=d);if(d+=’&u=’+o(c),c.match(/^https:/)&&d.match(/^http:/)&&(s=!1),a.getSelection?h=a.getSelection()+”:b.getSelection?h=b.getSelection()+”:b.selection&&(h=b.selection.createRange().text||”),d+=’&buster=’+(new Date).getTime(),s||(b.title&&(d+=’&t=’+o(b.title.substr(0,256))),h&&(d+=’&s=’+o(h.substr(0,512)))),f=a.outerWidth||b.documentElement.clientWidth||600,g=a.outerHeight||b.documentElement.clientHeight||700,f=f5e3?600:.7*f,g=g3e3?700:.9*g,!s)return void a.open(d,r,’location,resizable,scrollbars,width=’+f+’,height=’+g);i=q.getElementsByTagName(‘meta’)||[];for(var t=0;t200);t++){var u=i[t],v=u.getAttribute(‘name’),w=u.getAttribute(‘property’),x=u.getAttribute(‘content’);x&&(v?e(‘_meta[‘+v+’]’,x):w&&e(‘_meta[‘+w+’]’,x))}j=q.getElementsByTagName(‘link’)||[];for(var y=0;y=50);y++){var z=j[y],A=z.getAttribute(‘rel’);’canonical’!==A&&’icon’!==A&&’shortlink’!==A||e(‘_links[‘+A+’]’,z.getAttribute(‘href’))}b.body.getElementsByClassName&&(k=b.body.getElementsByClassName(‘hfeed’)[0]),k=b.getElementById(‘content’)||k||b.body,l=k.getElementsByTagName(‘img’)||[];for(var B=0;B=100);B++)n=l[B],n.src.indexOf(‘avatar’)>-1||n.className.indexOf(‘avatar’)>-1||n.width&&n.width<256||n.height&&n.height<128||e('_images[]',n.src);m=b.body.getElementsByTagName('iframe')||[];for(var C=0;C=50);C++)e(‘_embeds[]’,m[C].src);b.title&&e(‘t’,b.title),h&&e(‘s’,h),p.setAttribute(‘method’,’POST’),p.setAttribute(‘action’,d),p.setAttribute(‘target’,r),p.setAttribute(‘style’,’display: none;’),a.open(‘about:blank’,r,’location,resizable,scrollbars,width=’+f+’,height=’+g),b.body.appendChild(p),p.submit()}})(window,document,top.location.href,’https://dailybrowse.wordpress.com/wp-admin/press-this.php?v=8′);
The blog I need help with is: (visible only to logged in users)
-
Hi there,
It’s not possible to make this shorter, no. That bookmarklet is a JavaScript function, and it needs all of the code in there to work.
If Edge does not allow you to add a bookmarklet of that length I suggest you contact Microsoft support and ask them to change that. This bookmarklet works in all other browsers, meaning Microsoft likely chose to not follow a commonly used standard for stuff like this in their Edge browser.
I did some digging on this and it seems officially Edge doesn’t support bookmarklets at all:
The fact that you’re able to add it at all is due to a workaround in that browser.
-
Good luck with Microsoft changing Edge.
Back to reality: I appreciate your reply, but believe it’s inaccurate.
Making the bookmarklet shorter is possible, it’s code.
Shorter and the same functionality is probably too much to ask for since the code looks pretty tight.
How about shorter and remove 1 function, image retrieval. If I had the skill I would do it myself.
-
@zenpa we aren’t going to remove features to shorten the code. But if you don’t want to try tinkering with it on your own, maybe you can find an app that gives you better bookmarklet support.
-
Happiness Engineer? Ok then.
Not a fan of Edge either but it does seem that there could be a lot of people with the same issue who could be helped by WordPress staff.
Yes, I guess I’ll have to fix it myself since you are not willing to help.
Just for your information I downloaded your MacOS version of Press This a while ago and it is shorter and missing features, i.e. Image retrieval. It works on my Mac. Surprisingly it runs on Win10 too, but it’s useless since does not function as intended.
javascript:(%20function%20(e)%7Bvar%20t=document,n=window,s=n.getSelection,o=t.getSelection,i=t.selection,l=t.location,r=void%200;r=s?s():o?o():i?i.createRange().text:0;var%20a=e+%22?url=%22+encodeURIComponent(l.href)+%22&title=%22+encodeURIComponent(t.title)+%22&text=%22+encodeURIComponent(r)+%22&v=5%22,d=function()%7Bn.open(a,%22t%22,%22toolbar=0,resizable=1,scrollbars=1,status=1,width=660,height=570%22)%7C%7C(l.href=a)%7D;/Firefox/.test(navigator.userAgent)?setTimeout(d,0):d()%7D%20)(%20’https://wordpress.com/post/dailybrowse.wordpress.com’%20)
- The topic ‘Press This Bookmarklet too many characters for Edge Browser’ is closed to new replies.