Pages

How to create a Dynamic Javascript Bookmarklet

Hello Friends,

In The previous post I was tell you about How to create Bookmarklet. In This post I will tell you how to create a Bookmarklet using Dynamic  JavaScript.

Inline JavaScript had some limitation like we can only use 2000 character in inline JavaScript or direct  JavaScript. Direct JavaScript works fine for small action like redirecting the user to another web page, or searching the selected text using any search engine, changing the background of web page etc.

But when we want to perform any big task against the current web page using Bookmarklet, The limitation of direct JavaScript really hurts.

So today I am going to tell you How to deal such type of situation.

Follow the Insturction
In the Dynamic  JavaScript Bookmarklet we put our JavaScript code in Remote machine.

Our Bookmarklet  just load that remote  JavaScript code into our current web page.
Here's the code
javascript:(function(){
    _my_script=document.createElement('SCRIPT');
  _my_script.type='text/JavaScript';
 _my_script.src='http://192.168.1.100/samparkWithpost_source-tgt-lang.js?x='+(Math.random());
 document.getElementsByTagName('HEAD')[0].appendChild(_my_script);
})
();
this Bookmarklet code just pull down the our remote JavaScript file and add it to our current web page, so now we can add more code on our JavaScript file.