Reputation: 23
I have a bookmarklet code that starts with:
*javascript:var%20nodeaddpath="http://www..................*
and ends with:
*bout:blank"==l?nourl():a();;void(0);*
i didn't write to codes between start and end as they were not needed to write. Now i want to insert this bookmarklet to other web pages i.e html pages that appears like a link that when visitors click on it, it exactly works as when its on the bookmark bar of browser. I read many tutorials in stackoverflow and other websites but as they were not step by step, i couldn't use them. Please explain all details for me step by step as i am very new in programming that i can insert this bookmarklet to webpages.
Upvotes: 1
Views: 1243
Reputation: 119887
A bookmarklet, as far as I know, is just a piece of JavaScript. You program it in a way as if it existed and executed on the page. In other words, write it as if it's just a normal piece of script.
Bookmarklets on the page do not differ from the bookmarklets that are run from the bookmarks bar. They are just "post-processed" JavaScript run via the address bar.
And so, given a bookmarklet script of:
javascript:(function(){alert('hi');}());
You can embed it in the page like:
<a href="javascript:(function(){alert('hi');}());">Say Hi!</a>
Try dragging the link to the bookmarks bar and click it there, it does the same thing.
Upvotes: 2