Search code examples
javascriptbookmarklet

appending something to a bookmarklet-generated url


I'm using a bookmarklet to post URLs to my known installation.

javascript:(function(){window.open('http://xyz/known/share?share_url='+encodeURIComponent(location.href)+'&share_title\='+encodeURIComponent(document.title));})();

This returns the URL:

http://xyz/known/share?share_url=http%3A%2F%2Fwww.stichpunkt.de%2Fbookmarklets%2F&share_title=Bookmarklets

I want to have

&share_type=bookmark

appended to the url, yet since I don't understand JavaScript, fail to.


Solution

  • You can try this:

    javascript:(function(){window.open('http://xyz/known/share?share_url='+encodeURIComponent(location.href)+'&share_title\='+encodeURIComponent(document.title) + '&share_type=bookmark');})();