Test that snippet Bookmarklet

Force your browser to execute whichever (html or JavaScript) code on the page. Select with your mouse the portion of code you want to test and fire the bookmarklet. No more copy/paste/save/test needed. Try it on the snippets at http://www.irt.org/articles/js170/index.htm (try both JS and html) or the longer one at http://www.mountaindragon.com/html/css.htm.
Html code is opened in a new tab/window, while bookmarklets code (javascript:...) is applied to the current page. For pure JS you need to manually prepend 'javascript:' in the prompt field before pushing OK.
Works with Firefox 3.5 and Safari 4.

Source (no.web.site)


Download Bookmarklet:


View Bookmarklet Code:

Bookmarklet Source Code:

javascript%3A%28function%28%29%7Bfunction%20z%28w%29%7Bvar%20d%3Dw.document%2Cq%3Dw.getSelection%3Fw.getSelection%28%29%3A%28d.getSelection%3Fd.getSelection%28%29%3A%28d.selection%3Fd.selection.createRange%28%29.text%3A%27%27%29%29%2Ci%3Bif%28w.frames.length%21%3D0%29for%28i%3D0%3Bi%3Cw.frames.length%3Bi++%29try%7Bq+%3Dz%28w.frames%5Bi%5D.window%29%7Dcatch%28e%29%7B%7Dreturn%20q%7Dvar%20s%3Dz%28window%29%2Cj%3D%27javascript%3A%27%3Bs%3Dunescape%28escape%28s%29.split%28%27%25%27+%27uFFCA%27%29.join%28%27%20%27%29%29%3Bif%28s.length%3C2048%29s%3Dprompt%28%27Edit%20%5Cx26%20execute%20html%20/%20JavaScript%20code%27%2Cs%29%3Belse%7Bs%3Dconfirm%28%27Execute%20such%20a%20long%20html%20/%20JavaScript%20code%3F%27%29%3Fs%3Afalse%7Dif%28s%26%26s.length%3E2%29%7Bif%28s.indexOf%28%27%3C%27%29%3C2%26%26s.indexOf%28%27%3C%27%29%3E-1%29%7Bdd%3Dwindow.open%28%27%27%2C%27%27%2C%27%27%29.document%3Bdd.open%28%29%3Bdd.write%28s%29%3Bvoid%28dd.close%28%29%29%7Dif%28s.indexOf%28j%29%3C2%26%26s.indexOf%28j%29%3E-1%29void%28document.location%3Ds.substr%28s.indexOf%28j%29%29%29%3Belse%7Bvoid%280%29%7D%7D%7D%29%28%29


Rate it:


Tags:

Comments

Comments so far. Add yours.