Press-This 404 Issue

Press-This 404 Issue

I keep coming across an annoying issue with WordPress’ “Press-This” feature and I know I am not the only one. I am not sure of what the root cause of this is – if it is a Safari issue, a wordpress issue or a server configuration issue. Regardless, if you have been having difficulty with wordpress throwing a 404 whenever you use the bookmarklet you can try this simple fix which worked for me.

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='http://john-joyce.com/wp-admin/post-new.php',l=d.location,e=encodeURIComponent,u=f+'?u='+e(l.hostname+l.pathname)+'&t='+e(d.title)+'&s='+e(s)+'&v=4';a=function()%7Bif(!w.open(u,'t','toolbar=0,resizable=1,scrollbars=1,status=1,width=810,height=570'))l.href=u;%7D;if%20(/Firefox/.test(navigator.userAgent))%20setTimeout(a,%200);%20else%20a();void(0)

To use this, create a new bookmark and paste the above code into the URL or Location field.What’s different, you ask? All I changed is the encoding of the url, originally e(l.href) to the following e(l.hostname+l.pathname). This eliminates the “http://” portion which is what was causing the problem for me.

Screen Shot 2013-03-11 at 2.08.20 PM