How to Call JavaScript Function From URL

  1. Create Bookmarklets
  2. Creation of Bookmarks in Google Chrome
  3. Creation of Bookmarks in Mozilla Firefox
How to Call JavaScript Function From URL

The web page typically contains the JavaScript functions inside the specific page source.

There is no way to include Script functions or methods as hyperlinks for our webpage functionality, such as form validations checking for regular expressions, etc. However, we can quickly use bookmarklets to execute our JavaScript functions from our address bar.

Bookmarklets are available in most popular browsers by default; in this article, we will discuss the feature of bookmarklets in popular browsers such as Google Chrome and Mozilla Firefox and how to use that feature to call JavaScript function from URL instead of opening any webpage.

Create Bookmarklets

We can create bookmarklets by bookmarks; it is similar to creating a regularly used bookmark in browsers. The only variation is that we need to write JavaScript code statements rather than any http/s URLs.

Creation of Bookmarks in Google Chrome

Google Chrome provides the most efficient and excellent way to manage bookmarks; we can add or remove our bookmarks by simply following a few quick steps.

Creation of Bookmarks in Mozilla Firefox

To add, remove, or edit bookmarks, Mozilla Firefox provides a bookmarks menu as well. We need to navigate that menu and manage our bookmarks.

Enjoying our tutorials? Subscribe to DelftStack on YouTube to support us in creating more high-quality video guides. Subscribe

Related Article - JavaScript Function

Related Article - JavaScript Browser