Classic Websites Platform: Using JavaScript

HAVE A RESPONSIVE TEMPLATE? If so, please instead consult the 
Responsive Templates section for support. 

 

You may choose to use JavaScript in your manual customization templates. However, we recommend reviewing the following FAQ first.

 

Where do I put my scripts?

The best place to include scripts that you want on every page is in the Master Template "Header HTML." This ensures that it will be loaded on the page before any of your page content.

 

Sourcing External Scripts

JavaScripts can be externally sourced from any other servers using absolute URLs. However, note that JavaScript enforces domain security on scripts, so some actions in a script sourced from "www.mydomain.com" will not work on photoshelter.com.

If you have configured your domain to point to PhotoShelter (see Using Your Own Domain Name), you can get around this security restriction by setting a JavaScript "document.domain" in the Master Template. For instance, let's say your custom PhotoShelter domain name is "archive.mydomain.com" and your JavaScript file is being sourced off of "www.mydomain.com." If you set your javascript document.domain to "mydomain.com," the external scripts will be allowed. You should set your document.domain at the top of the HTML Header in the Master Template.

 

Known Compatibility Issues

PhotoShelter employs a proprietary JavaScript application framework that provides the basis for the dynamic (AJAX) functionality on many pages. Some third-party JS frameworks such as Prototype.js are known to be incompatible with this framework and should not be included in your customization templates. Please be sure to check your browser's JavaScript error console for errors if certain PhotoShelter functions (e.g. "Add to Cart") cease to operate; an "undefined property" or similar error is often a sign of a script conflict.

Still have questions? Contact us.

Comments

Powered by Zendesk