5

I just wrote my first bookmarklet. It is simple js code which takes the current page's URL and does a POST request to submit it to another page.

The problem is that I need to share this on a blogging platform (quora.com) that does not allow HTML. Thus, I need to post a link to my bookmarklet on a different website and provide a link to that. I'd like to be able to provide a single link that folks can drag to their bookmarks bar.

This is the bookmarklet code.

javascript:(function() {
    var msg = window.jQuery.ajax({url:'https://www.quora.com/api/logged_in_user',async:false,type:'GET'});
    var username = undefined;
    if (msg) {
        username = window.jQuery.parseJSON(msg.responseText.replace('while(1);',''));
    window.jQuery.post('https://my-website',
        {'answer_1':window.location.href,'submitter':username.name});
    alert (username.name + ' nominates  ' + window.location.href);
}})();
vsync
  • 118,978
  • 58
  • 307
  • 400
Mohan S Nayaka
  • 345
  • 3
  • 9

0 Answers0