Last updated 20 January 2013. Created on 16 March 2008.
Edited by thamas, heather, B747, add1sun. Log in to edit this page.

Prepopulate module was created for bookmarklets.

What's a bookmarklet?

Bookmarklets are links in your browser which "add one-click functionality to a browser or web page" says Wikipedia. For example, you could have a bookmarklet which makes it easier to post content to your website.

With the Prepopulate module, you can make bookmarklets that will fill out specific fields in your custom content types made through CCK.

How to edit a bookmarklet

Normal bookmarks on your browser's toolbar would have a title and a URL, which is just a plain web address starting with http://. A bookmarklet has a little script in the URL instead, starting with javascript:

Add a bookmark in your browser's favorites or bookmarks, or edit an existing one. In the case of Internet Explorer, you right click on the bookmark to access the properties, and then add in the javascript code (below) where it asks for the URL. It's the same for Firefox. In Safari you 'edit address'. Each browser is different.

Example bookmarklet code

Here is an example bookmarklet to post web links to a site


This turns into a URL like this:

The 's' variable puts in the selection, in the body of your node form; 'u' pulls in the current URL you are on; and 't' fills in the title. You can figure out the names of your fields by viewing the source, and modifying your field names accordingly.

Here's another example with different field names, and a link field with a title as well.


Feel free to add additional bookmarklet examples as child pages here.

Looking for support? Visit the forums, or join #drupal-support in IRC.


Brigadier’s picture

I'm using Drupal 6.8 with CCK 6.x-2.1 and Prepopulate 6.x-1.1.

This bookmarklet is almost the same as the one described above.


It fills in a textarea named "body" with the selected text. It fills in a CCK url called "field_external_link" with the URL. Notice one subtle difference: I had to use edit[body_field][body] - not edit[body_filter][body]. Not sure why but this one works for me.

Change "customenode" to your node type. Change "" to your domain & base path.

Donovan’s picture

I tried this bookmarklet on Drupal 6.9 and Prepopulate 6.x-1.1, with only changes to the "customnode", link field name, and domain & base path; but it does not completely work -- i.e.:

1. the form is not opening in a new window
2. the form fields are being populated with the javascript code instead of the results of executing the code

Here's my edited bookmarklet:

<a href="javascript:u=document.location.href;t=document.title;s=window.getSelection();void([title]=%22+escape(t)+'&edit[body_field][body]='+escape(s)+'&edit[field_link][0][url]='+escape(u),'_blank','width=1024,height=500,status=yes,resizable=yes,scrollbars=yes'));">Test</a>

Here are the results:

Title: *
" escape(t) '

Body: *
' escape(s) '

Link: *
' escape(u),'_blank','width=1024,height=500,status=yes,resizable=yes,scrollbars=yes'));

I know it's something simple, but can't figure it out. Any pointers are appreciated.

"It always seems impossible, until it is done."
- Nelson Mandela

aurelien-bordeaux’s picture

I can't figure out how to make it work ... but I would say that yourse doesn't because of the "href" at the beginning..

viksit’s picture

Add a new bookmark to your browser, where the location is javascript: ....

Its not an html link.

fadgadget’s picture

Hi i have the same problem as Donovan where i am trying to put the javascript into a draggable link to allow other people to add bookmarks to my site. If i enter the javascript directly into my browser i am fine but when i enclose it in these href tags it's deleting half the code (like Donovan) What would be the alternatives to add this code to a block to allow my members to add a bookmarklet to their browsers?


Im sure i managed to achieve it a year or so ago. Every week at least i try it again. Ive removed line breaks from input filters etc. Im missing something fundemental arent i?

maui1’s picture

I need a bookmaklet that will pre-populate a cck form with higlighted text from selected web sites. I have a version of this thats works well in Drupal 5.x grabbing selected text and filling in a blog form with title URL and content. I am not too good with Javascript and am looking for someone to help me create the bookmarklet for my Drupal 6.x installation.

giorgio79’s picture

I was looking for a bookmarklet that would get the Meta description instead of the highlighted text, and I found this:

Looks pretty good.

Now I just want to combine the it so that if no text is highlighted use the Meta description instead :)

tallsimon’s picture

Thank you, this is excellent.

Just one question - what is this supposed to but in the body field? All the other fields are populated. I am using a wysiwyg editor. And the body is blank. Should it have something in it?


ArtistConk’s picture

If your site is on a shared hosting environment (such as Hostgator) and you can't get bookmarklets to work, you may need to request a whitelist entry for mod_security from your hosting provider. In my case, using a bookmarklet generated with the Quickpost Bookmarklet module, the node form would pop up but the fields would remain blank - unless I was testing from a page within my website, which would work without issue. The whitelist entry solved the problem.