Press This bookmarklet not working?

Is or has your “Press This” bookmarklet stopped working for your website. A friend was having this specific issue today. Read on to see what we found.

Problem:

404 error when using “Press This”

Cause:

extra characters inserted into Press This bookmark (see example below)
specifically some of the equals (=) characters were replaced with %3D and that caused the link to break

[php]
javascript:var%20d%3Ddocument,w%3Dwindow,e%3Dw.getSelection,k%3Dd.getSelection,x%3Dd.selection,s%3D(e%3Fe():
(k)%3Fk():(x%3Fx.createRange().text:0)),f%3D%27http://domain.com/wp-admin/press-this.php%27,l%3Dd.location,e%3DencodeURIComponent,u%3Df%2B%27%3Fu%3D%27%2Be
(l.href)%2B%27%26t%3D%27%2Be(d.title)%2B%27%26s%3D%27%2Be(s)%2B%27%26v%3D4%27%3Ba%3Dfunction()%7Bif(!w.open(u,%27t%27,%27toolbar%3D0,resizable%3D1,
scrollbars%3D1,status%3D1,width%3D720,height%3D570%27))l.href%3Du%3B%7D%3Bif%20(/Firefox/.test(navigator.userAgent))%20setTimeout(a,%200)%3B%20else%20a()%3Bvoid(0)
[/php]

Solution:

Copy Press This code from working site and then replace domain (see example below)

[php]
javascript:var%20d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():
(x?x.createRange().text:0)),f=’https://yourlocaltech.com/wp-admin/press-
this.php’,l=d.location,e=encodeURIComponent,u=f+’?u=’+e(l.href)+’&t=’+e(d.title)+’&s=’+e(s)+’&v=4′;a=function()
{if(!w.open(u,’t’,’toolbar=0,resizable=1,scrollbars=1,status=1,width=720,height=570′))
l.href=u;};if%20(/Firefox/.test(navigator.userAgent))%20setTimeout(a,%200);%20else%20a();void(0)
[/php]

Actual Cause of bad Press This code?

Unknown at this time. Solution was just to fix bookmarklet and move on than spending countless hours to find why the bookmarklets were borked.

Need Help?
Contact Me

2 Comments

  1. Oscar Gonzalez aka @notagrouch on November 1, 2012 at 5:45 pm

    Thanks so much for your help working on this Loren. It was driving me crazy, it still sucks that I don’t know the cause but as soon as I have more time to debug, I will. For now using your clean code helped quite a bit and I can actually share the 30 day challenge posts easily at oglink.it 🙂 Thank you again!

  2. Loren Nason on November 1, 2012 at 6:25 pm

    No prob Oscar. Still weird how the bookmarks got borked though and then mine worked on your machine. It is what it is and just move past it.

Leave a Comment