Reputation: 101
Currently working on liferay with IE8 Issue. So, I want to make a division IE8 and the others..
in liferay-portlet.xml
if (IE8){
'<'header-portlet-javascript'>'/resources/js/protovis/ie8/protovis.js'<'/header-portlet-javascript'>'
'<'header-portlet-javascript'>'/resources/js/protovis/ie8/protovis-msie-shim.js'<'/header-portlet-javascript>
}else{
'<'header-portlet-javascript>/resources/js/protovis/protovis.js'<'/header-portlet-javascript>
'<'header-portlet-javascript>/resources/js/protovis/protovis-msie-shim.js'<'/header-portlet-javascript>
}
How to achieve this?
Upvotes: 0
Views: 146
Reputation: 854
The simplier way to include differnt javascritp (if you have already a custom template) is to do that into velocity templates.
There you can use IE directive to tell what scripts include in each browser version. A sample below:
<script src="custom.js"></script>
<!--[if IE 9]>
<script src="custom.ie9.js"></script>
<![endif]-->
<!--[if lte IE 8]>
<script src="custom.ie8.js"></script>
<![endif]-->
If you prefer you could also include scripts dinamically by checking Liferay.Browser variable.
Upvotes: 1
Reputation: 3386
you can't do it in liferay-portlet.xml
for more information you can refer to
http://docs.liferay.com/portal/6.1/definitions/liferay-portlet-app_6_1_0.dtd.org.html
you can use jQuery.getScript() for this purpose
Upvotes: 0
Reputation: 4210
You can not write condition in liferay-portlet.xml this way.
But you can use navigator variable to check Browser detail and include required js code.
Upvotes: 0