Last updated June 12, 2012. Created on June 12, 2012.
Edited by TravisCarden. Log in to edit this page.

A bookmarklet is an applet, a small computer application, stored as the URL of a bookmark in a web browser or as a hyperlink on a web page. The term is a portmanteau of the terms bookmark and applet. Whether bookmarklet utilities are stored as bookmarks or hyperlinks, they are designed to add one-click functionality to a browser or web page. When clicked, a bookmarklet performs some function, one of a wide variety such as a search query or data extraction. Usually the applet is a JavaScript program. - Wikipedia

To use one of these bookmarklets, create a new bookmark in your browser and copy and paste the bookmarklet code into the location/address field.

Log in

This bookmarklet, taken with permission from Jeff's Handy Dandy Drupal Login Bookmarklet, will take you to the Drupal login page of the current web site (if it is a Drupal site) and append the current path into the destination URL parameter so that, after logging in, you will be redirected back to the page you were on before.

Code: javascript:(function(){if(typeof%20Drupal!='undefined'&&typeof%20Drupal.settings!='undefined'){var%20u=false;if(typeof%20jQuery!='undefined'&&(jQuery('body.logged-in').length)){if(!confirm("It%20looks%20like%20you're%20already%20logged%20in.%20Continue?")){return;}}var%20l=window.location;var%20h=l.hash||'';||'';var%20b=Drupal.settings.basePath;var%20p=l.pathname.slice(b.length)||'<front>';window.location.href=l.protocol+"//""index.php?q=user&destination="+escape(p+s+h);}else{alert("This%20doesn't%20appear%20to%20be%20a%20Drupal%20site.");}})();

Is it Drupal?

This bookmarklet uses Joe Shindelar's logic to determine whether the active web site is built with Drupal or not. It assumes a base URL of the domain root.

Code: javascript:var req1=new XMLHttpRequest;"GET","/misc/drupal.js",true);req1.onreadystatechange=function(){if(req1.readyState==4){if(req1.status==200&&Number("var Drupal = Drupal"))>=0){alert("Yes")}else{var a=new XMLHttpRequest;"GET",window.location,true);a.onreadystatechange=function(){if(a.readyState==4){if(a.getResponseHeader("Expires")=="Sun, 19 Nov 1978 05:00:00 GMT"){alert("Probably")}else{alert("Probably not")}}};a.send(null)}}};req1.send(null)

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


rafal.enden’s picture

Close overlay and open current page without overlay
javascript:(function(){ hash=location.hash; if(hash.length>0) location=location.protocol+'//'+location.hostname + ':' + location.port +'/'+location.hash.substring(9); })()

Log out from Drupal
javascript:var req1 = new XMLHttpRequest;"GET", "/misc/drupal.js", true);req1.onreadystatechange = function() {if (req1.readyState == 4) {if (req1.status == 200 && Number(req1.responseText.indexOf("var Drupal = Drupal || { 'settings': {}, 'behaviors': {}, 'themes': {}, 'locale': {} };")) >= 0) {location=location.protocol+'//'+location.hostname+':'+location.port+'/logout?destination='+location.pathname;}else if (req1.status == 200 && Number(req1.responseText.indexOf("var Drupal = Drupal || { 'settings': {}, 'behaviors': {}, 'locale': {} };")) >= 0) {location=location.protocol+'//'+location.hostname+':'+location.port+'/user/logout?destination='+location.pathname;}else {}}};req1.send(null)

Change language
javascript:(function(){var langCode = prompt('Language code'); if (langCode.length > 0) location=location.protocol+'//'+location.hostname+':'+location.port+'/'+langCode;})()

Open node
javascript:(function(){var nid = prompt('Enter NID'); if (nid.length > 0) location=location.protocol+'//'+location.hostname+':'+location.port+'/node/'+nid;})()

froboy’s picture

I've found that this overlay script can fail if other modules add things to the overlay string. This modification works better for me.

javascript:(function(){ hash=location.hash; pos=hash.indexOf('overlay=')+8; if(hash.length>0) location=location.protocol+'//'+location.hostname + ':' + location.port +'/'+location.hash.substring(pos); })()

sandervd’s picture

javascript:(function(){jQuery('.fieldset-title').each(function() {jQuery(this).click()});})();