Posted By

wizard04 on 11/04/09


Tagged

javascript location hack script greasemonkey bookmarklet user address


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

wirenaught


User-Script Location Bar Hack


 / Published in: JavaScript
 

URL: http://wiki.github.com/Martii/greasemonkey/location-hack

Runs a function from the address bar (like a bookmarklet). This can be used in Greasemonkey scripts to get around an XPCNativeWrapper object without accessing unsafeWindow.

  1. /****************************************
  2. Runs a function from the address bar (like a bookmarklet). This can be used in Greasemonkey scripts to get around an XPCNativeWrapper object without accessing unsafeWindow.
  3.  
  4. Based on http://wiki.github.com/Martii/greasemonkey/location-hack
  5. /****************************************/
  6.  
  7. function runLocationHack(func)
  8. {
  9. location.href = 'javascript:(function(){('+encodeURI(func)+')()})()';
  10. }

Report this snippet  

You need to login to post a comment.