Message Boards
Multiple including javascript libs poroblem
Vahid Kh, modified 4 Years ago.
Multiple including javascript libs poroblem
Junior Member Posts: 54 Join Date: 8/6/19 Recent Posts
Hey friends
I use this method for including a javascript library into my portlet :
It works correctly if only there is one instance in a page, But for more instance , other instances not return error
How can I prevent including multiple time?
I use this method for including a javascript library into my portlet :
<script>
Liferay.Loader.define._amd = Liferay.Loader.define.amd;
Liferay.Loader.define.amd = false;
</script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/highcharts.js" ></script>
<script>
Liferay.Loader.define.amd = Liferay.Loader.define._amd;
</script>
It works correctly if only there is one instance in a page, But for more instance , other instances not return error
How can I prevent including multiple time?
Olaf Kock, modified 4 Years ago.
RE: Multiple including javascript libs poroblem
Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent PostsVahid Kh:
I use this method for including a javascript library into my portlet :...
It works correctly if only there is one instance in a page, But for more instance , other instances not return error
How can I prevent including multiple time?
You'll declare it in your portlet's header as one of these:
com.liferay.portlet.header-portlet-javascript
com.liferay.portlet.footer-portlet-javascript