Implementing bookmarklets in JavaScript
2ality.com
Implementing bookmarklets in JavaScript
1–10 of 15 posts
Re: Implementing bookmarklets in JavaScript
#2Re: Implementing bookmarklets in JavaScript
#3this is ok- and even shows you how to do async loads. an article targeting more comprehensive bookmarklets might recommend your bookmarklet should only load an external script. additionally, some discussion of postmessage would be cool. you can actually create insanely robust bookmarklets posting messages (and using views) through an iframe(s).
Re: Implementing bookmarklets in JavaScript
#4this is ok- and even shows you how to do async loads. an article targeting more comprehensive bookmarklets might recommend your bookmarklet should only load an external script. additionally, some discussion of postmessage would be cool. you can actually create insanely robust bookmarklets posting messages (and using views) through an iframe(s).
Do you have an example of something cool done with postmessage? I've never seen that term before.
essentially, it gives you two-way communication to your server on any arbitrary domain- that's pretty powerful!
Re: Implementing bookmarklets in JavaScript
#5Re: Implementing bookmarklets in JavaScript
#6Earlier quoted context omitted.
Do you have an example of something cool done with postmessage? I've never seen that term before.
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! [1] https://gist.github.com/1020251
Re: Implementing bookmarklets in JavaScript
#7They also don't have a favicon (or I haven't seen one in FF4) without a user pre-visiting a destination page, so they look unpolished.
Re: Implementing bookmarklets in JavaScript
#8this is ok- and even shows you how to do async loads. an article targeting more comprehensive bookmarklets might recommend your bookmarklet should only load an external script. additionally, some discussion of postmessage would be cool. you can actually create insanely robust bookmarklets posting messages (and using views) through an iframe(s).
Re: Implementing bookmarklets in JavaScript
#9this is ok- and even shows you how to do async loads. an article targeting more comprehensive bookmarklets might recommend your bookmarklet should only load an external script. additionally, some discussion of postmessage would be cool. you can actually create insanely robust bookmarklets posting messages (and using views) through an iframe(s).
I see you use the (function() {…})(); syntax in your gist, while the linked article uses (function() {…}()); I tried some simple experiment, even passing a param in the outer parens, and both seemed to work the same, and ok. Is one of these "right" and the other one "wrong"?
Problem at line 1 character 17: Move the invocation into the parens that contain the function.
Crockford seems to prefer the latter but I don't know why.Re: Implementing bookmarklets in JavaScript
#10There's a great collection of bookmarklets at https://www.squarefree.com/bookmarklets/ (Fron the same guy who tracks changes in Firefox's nightly builds: http://www.squarefree.com/burningedge/ )
You can also turn bookmarklets into GreaseMonkey scripts so they can be ran automatically on certain sites (in Firefox): http://www.squarefree.com/2005/05/16/bookmarklets-to-user-sc...