Re:Implementing bookmarklets in JavaScript
by thechangelog on Saturday June 11, 2011 @12:32AM
(#2643214)
Do you have an example of something cool done with postmessage? I've never seen that term before.
[ Parent
| on HN ]
Re:Implementing bookmarklets in JavaScript
by catshirt on Saturday June 11, 2011 @12:33AM
(#2643215)
i threw some example code [1] on gist to supplement my comment. i modified it a bit and didn't test it- but it used to work- so probably still good for reference. it's also not very pretty. questions, comments, concerns welcome.
essentially, it gives you two-way communication to your server on any arbitrary domain- that's pretty powerful!
Re:Implementing bookmarklets in JavaScript
by buddydvd on Saturday June 11, 2011 @03:13AM
(#2643395)
Instead of polling, you can define event handlers for <script>'s onload and onreadystatechange event to detect when jQuery gets loaded. See Ben Alman's jQuery bookmarklet generator for an example: http://benalman.com/code/test/jquery-run-code-bookmarklet/