2009/12/2 greghauptmann <greg.hauptm...@gmail.com>: > > What about caching the user credentials - how would you cache this > typically? (noting the username/password could not be tied to a > particular page/tab, so it would have to be cached at the overall > browser context if this makes sense) > > Also re caching the username/password is there a way to cache it after > the browser closes & then starts up, or would it not be possible for > this scenario?
You can simplify your bookmarklet to just redirect the browser to your website with the address of the website on which the user clicked your bookmarklet encoded in the uri. Something like this: javascript:(function(){location.href='http://your.website/script?x='+encodeURIComponent(location.href);})(); And do everything, including authentication, authorization, sessions, cookies, etc. on your website where you will have the address of the original website in the x parameter, uri-encoded, as if someone has just entered the address in a form on your website. For example this will search for the current location in Google: javascript:(function(){location.href='http://www.google.com/search?q='+encodeURIComponent(location.href);})(); Then you can redirect the browser back to the original page after your script does what it needs to, or you can use window.open(URI) instead of location.href=URI to open your website in a new window and close it when it's done. If you want to make the process invisible without any windows opening and pages reloading then it gets more hairy, because you'd have to use JSONP or manually inject script tags to load a script from the server, and you'd have to make sure you access the cookies on the server and not in the browser or otherwise you probably won't be accessing the cookies you want. Rafał Pocztarski