Requestly
Published in

Requestly

Inserting scripts dynamically in a webpage

Requestly brings you one of the most powerful tool which may prove to be replacement for many browser extensions.
Using “Insert Scripts” rule, you can make on-the-fly changes to a webpage content.

Inject popular libraries or hosted scripts or execute custom code-snippet before or after page load using simple rule builder.

If you love hacking, playing with automations, scraping, changing default website’s behaviour and have some basic knowledge of JavaScript, there’s a lot you can do here.

For example, remove/hide unwanted sections from page, add quick action buttons, add your own libraries to support your script, etc.

Every time the page is viewed, the specified script will be executed and changes will apply, thereby making the user experience seamless.
Similar to any other rules in Requestly, Script rules too can be setup to execute on one or more web pages simultaneously.

here’s a quick demo video:

How to create a Script rule using Requestly?

  1. Install Requestly extension if you have not previously installed it.
  2. Click on requestly icon in browser toolbar or Open https://app.requestly.io/rules
  3. Click on Add (+) Icon to create a new Rule
  4. Click on “Insert Scripts” card.

Enter rule name, description and webpage source where the rule has to be applied.

Select libraries (from available options) you want to include in webpage in order to support your custom scripts.

Click “Add Custom Script” button to add custom scripts which can be of two types:

  1. URL- source of an external script
  2. Code- JavaScript code snippet

Please note that Code script has a size limit. For longer code, one must create script file in Requestly File Library and copy URL to URL type custom script.

Each custom script has an option to be either included before page load or after page load. This provides user more flexibility to achieve multiple use-cases.

The extension ensures that firstly all libraries are inserted as custom scripts might depend on them. After libraries, all scripts meant to be loaded before page load are executed and then all scripts meant to be loaded after page load in the same order as they were added in rule builder.

For security reasons, rules created by a user remains private to him/her unless he deliberately shares with other users.

If you have any query or feedback, please feel free to reach out to contact@requestly.io. We would love to respond to each of them.

--

--

Setup redirects, modify headers, query params, switch hosts, insert user scripts and much more by configuring rules in your browser with Requestly. Install it on Chrome and Firefox and join our family of more than 100K+ developers!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Requestly

Setup redirects, modify headers, switch hosts, insert user scripts and much more. Install it on Chrome & Firefox and join our family of more than 100,000 devs!