Overview


Script Hosting

There are two places you can host your scripts. On BrowserBot.com by logging into the online platform, or on a remote server of your choosing. When loading remote scripts, it's important to set the right CORS headers so the browser will be allowed to access the script. Below is an example of how to set the Access-Control-Allow-Origin header to '*' in PHP. This is required if you're going to be accessing the script form a domain other than the one currently loaded in the browser.

<?php

header('Access-Control-Allow-Origin: *');

HTTP vs HTTPS

When loading a remote script it's important to remember that a website running on HTTPS will not allow you to include outside scripts not running on HTTPS. So if you plan to host your scripts remotely, it's best to be accessing them over HTTPS.

Script Persistence

If Persists is set to true when attaching a script, the script will be reapplied every time the page refreshes. This is useful if you want to have the logic of your workflow stored in the JavaScript file itself.

Maintaining Session Data

When a page refreshes, your script will lose any data associated with it. If you need data to persist between page loads the easiest way is to call the GetBrowserInfo API Endpoint in order to get the BrowserID and then use that as a key to store Data remotely. Check out the "Session Data" tutorial for more information.