+ Start a Discussion
Anthony PicaAnthony Pica 

Conditionally link to assets



If the parent page element is selected then the Scripts and Style Sheets menus appear in the Properties tab on the right. In the Script menu we can add scripts to both <head> and <body>. Additionally, we can configure the content of <head>. This is how I am including some <meta> content and a <!--[if IE]> statement. My question is how do I conditionally link to assets?


For example, below is the code from our original site with the original relative paths. How do I link to selectivizr-min.js without hosting the file myself? This file is already imported, I just need to know the location of it in Siteforce so I can link to it.


<!--[if IE]>
<script type="text/javascript" src="media/js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="media/js/selectivizr-min.js"></script>
<script type="text/javascript" src="media/js/jquery.placeholder.js"></script>
<script>$(document).ready(function() { $(document).placeholder(); });</script>
<link type="text/css" rel="stylesheet" href="media/css/ie.css" /> 
<!--[if lte IE 6]>
<link type="text/css" rel="stylesheet" href="media/css/ie6.css" /> 


Thanks in advance,



Hi Anthony,


As far as I know, you can add all js and css files as Assets but you can't create folders. In other words, you can't have a tree structure for Assets.


Try to link the files directly to the "root" folder:

<!--[if IE]>
<script type="text/javascript" src="jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="selectivizr-min.js"></script>
<script type="text/javascript" src="jquery.placeholder.js"></script>
<script>$(document).ready(function() { $(document).placeholder(); });</script>
<link type="text/css" rel="stylesheet" href="ie.css" /> 
<!--[if lte IE 6]>
<link type="text/css" rel="stylesheet" href="ie6.css" /> 

Bear in mind the current css files issues in Siteforce:



Kind regards,