We could create a page template for the page on which we want it. If the requirement is static and small, that is a way to do it, though putting the script directly in the template is not the best-practices way to do it, for several reasons.
In this example, though, we want the contents of the script to contain dynamic data.
- We have set a session variable containing a file path
- When our page loads, if that session variable is set, we want to a popup window that opens the file it references
We want to have the popup appear once the page has finished loading, so we can add a jquery function to be executed at that time.
This should result in the following being added to our page header: