I was trying recently to utilize bookmarklets for injection of custom code into arbitrary webpage to get control a provide some additional funcitonality.. for example transfering the content of openlayers maps into MapShake. Not heard about MapShake ? I will post soon more. My bookmarlet looks like this:
javascript:(function(){var%20s=document.createElement(%22script%22);s.charset=%22UTF-8%22;s.src=%22http://www.sumbera.com/lab/MapRip/MapRip.js%22;document.body.appendChild (s)})();
try{
var rippedMap = map;
var format = new OpenLayers.Format.WMC({‘layerOptions’: {buffer: 0}});
var text = format.write(rippedMap);
var w;
setTimeout(‘w=window.open(“”,””,”width=600,height=1200,resizable=0,scrollbars=1″);e(w);’,10);
function e(w){
d = w.document;
d.write(“<textarea id=’wmc’ rows=’100′ cols=’65’>” + text +”</textarea>”);
d.close();
w.focus()
}