03/29: Bookmarklet to get opener's HTML
Category: Web dev
Posted by: hajime osako
javascript:Q='';x=document;y=window;if(x.selection){Q+=x.selection.createRange().text;}else if(y.getSelection){Q+=y.getSelection();}else if(x.getSelection){Q+=x.getSelection();}w=window.open('','_blank','width=600,height=250');f=w.document.createElement('form');f.setAttribute('action','<?echo Utilities::buildUrl(true);?>/bookmarkletPage.php?logtext='+escape(Q)+'&loglink='+escape(x.location.href)+'&logtitle='+escape(x.title));f.setAttribute('method','POST');i=w.document.createElement('input');i.setAttribute('type','hidden');i.setAttribute('name','ihtml');i.setAttribute('value',encodeURIComponent(x.documentElement.innerHTML));f.appendChild(i);w.document.documentElement.appendChild(f);w.focus();f.submit();"