I am trying to load a javascript library in XPages.
Normally in HTML the reference looks as followed:
<html>
<head>
<script src="https://hammerjs.github.io/dist/hammer.js"></script>
</head>
<body>
</body>
</html>
which gives me a Hammer object in the DOM which I can work further with.
In XPages I have made the following setup:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" disableTheme="true"
dojoForm="false" dojoTheme="false" dojoParseOnLoad="false"
createForm="false">
<xp:this.resources>
<xp:script src="https://hammerjs.github.io/dist/hammer.js"
clientSide="true">
</xp:script>
</xp:this.resources>
</xp:view>
alternatively:
<?xml version="1.0" encoding="UTF-8" ?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" disableTheme="true" dojoForm="false" dojoTheme="false" dojoParseOnLoad="false" createForm="false">
<xp:this.resources>
<xp:headTag tagName="script">
<xp:this.attributes>
<xp:parameter name="script" value="text/javascript" />
<xp:parameter name="src" value="https://hammerjs.github.io/dist/hammer.js" />
</xp:this.attributes>
</xp:headTag>
</xp:this.resources>
</xp:view>
But the Hammer object is not present in the DOM!
What am I doing wrong?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…