Social Media Magazine

Javascript Bookmarklet Create Javascript Bookmarklet in Google Chrome

Posted on the 29 January 2017 by Pro Webguru @prowebguru

You might have seen some of the popular sites providing you an option of bookmarklet, which you can drag to your favorites bar and after clicking on that it will perform some operation like opening a new window with pre populated information or performing something on current screen.

It is easy to create javascript bookmarklets, in which you can write your custom javascript code to perform some functions.

I will show you how to create simple bookmarklet in different browsers.

On clicking of this bookmarklet, we will just display some information in alert. This is just a kind of "Hello World" bookmarklet for those who don't have idea about it. Same can be extended to implement more complex operations.

We will use following javascript code for this.

alert("Hi, How are you ?");

Let's start!

How to Create Javascript Bookmarklet in Google Chrome ?

  1. To create a bookmarklet in google chrome, make sure your favorites bar is visible on screen.
  2. Right click on favorites bar and click on "Add Page..." option.
  3. It will show following screen
  4. In the Name tab, enter the name of your bookmark.
  5. Now in URL part we will put our Javascript code prepended by "javascript:" and we will create a simple function which we will call.
  6. So now our final URL will be javascript:function test() {alert('Hi, How are you ?');} test();
  7. Click Save and we are done.

We have just created our first javascript bookmarklet in javascript.

Same method can be used to do some complex processing like creating forms for submission of information for a website, do some analysis on webpage like finding email addresses from webpage, finding urls from webpage with this simple javascript code.

Tell me if you can use it to create some kind of useful stuff for your use.

Check Javascript Function to Replace All Occurances of String


You Might Also Like :

Back to Featured Articles on Logo Paperblog

These articles might interest you :

  • Spoiler Alert | The CW Releases More ‘Arrow’ Premiere Images

    Spoiler Alert Releases More ‘Arrow’ Premiere Images

    “Green is the new black.” – Stephen Amell More photos from Arrow’s season 7 premiere episode, titled Inmate #4587, have been released, and these are all about... Read more

    The 18 September 2018 by   Entertainmentjolt
    ENTERTAINMENT, TV & VIDEO
  • Disrupt Facebook!

    Disrupt Facebook!

    A business model is a plan for the successful operation of a business, identifying sources of revenue, the intended customer base, products, and details of... Read more

    The 18 September 2018 by   Thinkibility
    BUSINESS, LIFE COACH
  • Carolina Strong & Have You Marked Yourself Safe?

    Carolina Strong Have Marked Yourself Safe?

    Still getting through Hurricane Florence here in the Carolinas. While I live in central NC, we have had our share of flooding, trees down, power outages and yes... Read more

    The 18 September 2018 by   Midlifemargaritas
    LIFESTYLE
  • Questions to Be Asked About Discussion of Sexual Abuse: Why Is Abuse of...

    Questions Asked About Discussion Sexual Abuse: Abuse Vulnerable Females Adult Males Shrugged Easily?

    Speaking from the vantage point of a "but half-woke" straight male, David Roberts writes, Sexual discrimination, harassment, and abuse are everywhere. Read more

    The 18 September 2018 by   William Lindsey
    LGBTQ, RELIGION, SOCIETY
  • What to Do Instead of Counting Calories?

    A while ago, Dr. Andreas Eenfeldt met Dr. Jason Fung to discuss calorie counting. Is it the best way to lose weight or is it more complicated than the theory... Read more

    The 18 September 2018 by   Dietdoctor
    DIET & WEIGHT, HEALTH, HEALTHY LIVING, MEDICINE
  • Boeing 787-9 Dreamliner

    Boeing 787-9 Dreamliner

    @ San Francisco, CA June 2018 A Virgin Atlantic Dreamliner on final approach for landing at SFO.  Virgin operates 17 Dreamliners in their current fleet,... Read more

    The 18 September 2018 by   Htam
    PHOTOGRAPHY, SOCIETY
  • On Waiting…

    Waiting…

    We are sitting in a government office in Suleimaniyah (commonly called Suli) and we are waiting. We left Rania at seven in the morning. The sun had already... Read more

    The 18 September 2018 by   Marilyngardner5
    RELIGION, SELF EXPRESSION

Magazines