Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>bombedmetor,</p> <p>Greg Guida's tip on including an external script will allow you to create an awesome, clean bookmarklet-based toolbar. Why? Because you'll be able to use JavaScript libraries like JQuery, etc.</p> <p>Here's a quick example along the lines you asked for to help get you started. The bookmarklet creates a div element with a link to the Stack Overflow homepage.</p> <pre><code>javascript:void(function(){var divElmt=document.createElement('div');link1=document.createElement('a'); link1.href='http://stackoverflow.com';link1.innerHTML='StackOverflow Homepage';divElmt.style.backgroundColor='yellow';divElmt.style.position='fixed';divElmt.style.top='0px';divElmt.style.width='10em';divElmt.style.height='5em'; divElmt.style.border='solid red 4px';divElmt.style.zIndex='100'; divElmt.appendChild(link1);document.body.appendChild(divElmt);})(); </code></pre> <p>To use the above bookmarklet, you create a new bookmark in your favorite browser and add the code above where you would normally place the URL. </p> <p>The code does the following:</p> <ol> <li>Creates a new div element.</li> <li>Creates a new anchor element and sets the value of the href attribute.</li> <li>Assigns some basic values to the style attributes of the new div (so you can see it easily).</li> <li>Appends the anchor as a child element of the new div.</li> <li>Appends the new div element as a child of the body element.</li> </ol> <p>If all goes well, you should see a yellow box with a link to the Stack Overflow homepage at the top-right of your page after using the bookmarklet. bombedmetor - I hope this helps get you started. After you get comfortable with how these things work, you can apply Greg's wisdom to create your toolbar bookmarklet in a way that can be added to people's browsers with just a click or two.</p> <p><strong>Something to keep in mind:</strong> As Greg indicates, bookmarklet code is treated as the contents of the href attribute of an anchor element. This is why I used single quotes in the code above.</p> <p>Some sites/articles to check out:</p> <ul> <li><a href="http://en.wikipedia.org/wiki/Bookmarklets" rel="nofollow">http://en.wikipedia.org/wiki/Bookmarklets</a></li> <li><a href="http://www.latentmotion.com/how-to-create-a-jquery-bookmarklet/" rel="nofollow">http://www.latentmotion.com/how-to-create-a-jquery-bookmarklet/</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload