Linking with javascript in Zenpages
Hi Guys,
Sorry I'm not that familiar in using Javascript in Zen pages, so basically we have a priting utility (app) that requires us to add a bit of JavaScript call to facilitate printing from our Zen pages as below:
.png)
So I added XData link pasted the required script, is this the correct way?
.png)
Thanks
Comments
For including an external JavaScript file in a Zen page, the relevant suggestion in the retrieved material is to add it as a page parameter like this:
Parameter JSINCLUDES = "js/BrowserPrint-3.1.250.min.js"; [1]
The retrieved material does not provide support for pasting the script into an XData link block, so based on what was found, the documented/recommended approach here is the JSINCLUDES parameter rather than the XData approach. [1]
If you need to call JavaScript from the Zen page itself, the retrieved examples also show using Zen client-side methods, for example:
ClientMethod runReport() [ Language = javascript ] { ... } [2]
and client-side event handlers such as:
onclick="zenPage.startCam()" [3]
So the likely pattern is:
- include the external
.jsfile withJSINCLUDES - invoke its functions from Zen client-side JavaScript methods or handlers. [1][2][3]
Sources: