How to Support an External Library that Needs Per Page Reload
Last updated on JANUARY 20, 2016
Applies to:Oracle Commerce Cloud Service - Version N/A and later
Information in this document applies to any platform.
OCCS (Oracle Commerce Cloud Service) is a single-page application. All pages are dynamic and there is just one page that changes content based on the requirements (e.g. a URL change).
One example of such a library is Google Trusted Store.
This article outlines a workaround to make sure that the library reloads when the page changes on OCCS. The following points are to be noted while working on this:
- OCCS uses requireJs to dynamically load a library when required. Once loaded, the library is not loaded again and the cached version of the library is used. However, requireJs has the require.undef method that can be used to "undefine" a particular library and which will cause it to be reloaded.
- OCCS has a set of JQuery callbacks (pubsub) that publishes events such as page change, page loaded etc. These are very useful to find out when a page is changed/ ready.
The work around uses this information to create a pseudo page change and unload and load a library when required.
Sign In with your My Oracle Support account
Don't have a My Oracle Support account? Click to get started
My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms