js.run_on_activity

/ Script and Style / js.run_on_activity

Note: this is available from 3.3.1 onwards.

Title : js.run_on_activity
Purpose : This shortcode can be used to load scripts or code on any user activity to help improve the frontend performance of the site.
Syntax :
Input Parameters : src: the src URL of the script that you want to include during the activity.
content: the script code specified here will be executed as is, and if src is specified then the content script will be executed after the script is loaded
Return Value : Wrapped script for execution
Example 1 :
Code :
Output : This will include the script specified by “src” attribute when a user interacts with the browser
Example 2 :
Code :
Output : In this example first, the src URL will be loaded and then the content script will be executed on user interaction
Example 3 :
Code :
Output : In this example directly the content script will be executed after user interaction.
Categories
Most Popular

Leave a Reply

Your email address will not be published.