Sections
Profile Picture of the author

Adding Javascript to a Page

on 02-17-2024 07:50 PM by Ted Battreall

592

Tips and Tricks: Adding Javascript to a Page


The Challenge

If you copy a webpage that has embedded javascript, the SnapApp page builder will automatically remove the javascript for security reasons. 


The Solution

1) Copy the javascript to a .js file 

First, move all javascript in the source webpage to a separate javascript file.  This file should have a .js file extension.

2) Go to the detail-view for the page.

To upload the javascript file to the page, you need to go to the /detail-view of the page.  You can get there by:

  • From Settings Home: Select Views from the UX menu. Find the view and clicking the link on the view name.
  • From the Pagebuilder: Open the Details modal by clicking the second button on the top navbar. Click File Attachments button

2) Upload attachment 

Upload the .js file to the page, click " Add New Attachment " in the attachments related list below the page details. 

Screenshot 2024-02-17 at 6.39.05 AM.png


Then select " File " from the Type dropdown and drop the file on to file field:

Screenshot 2024-02-17 at 6.39.05 AM.png



Generate Text