I'd like to use the SPUtility.MakeBrowserCacheSafeLayoutsUrl method in my published master page (used in a publishing site) in order to force SharePoint to stop caching my JavaScript and CSS files.
If I was working with a traditional .aspx page, this would suffice:
<script type="text/jscript" src="<%=Microsoft.SharePoint.Utilities.SPUtility.MakeBrowserCacheSafeLayoutsUrl("projectName/scripts/plugins/tapes_report_definition.js", false)%>" ></script>
But being a published Master Page, the tagging concept is a bit different. For example, this is what a JavaScript reference looks like:
<!--MS:<SharePoint:ScriptLink name="sharing.js" OnDemand="true" runat="server" Localizable="false">-->
<!--ME:</SharePoint:ScriptLink>-->
So I've been trying various ways to include that inline call to the cache method; here's what I've tried:
Simple script tag with inline code
<script src="<%=Microsoft.SharePoint.Utilities.SPUtility.MakeBrowserCacheSafeLayoutsUrl("IntrinsiQ.UserPortal.SharePoint/scripts/portal-main.js", false)%>"></script>
Result: '<', hexadecimal value 0x3C, is an invalid attribute character
Script tag surrounded in SharePoint MS/ME tags
<!--MS:<script src="<%= Microsoft.SharePoint.Utilities.SPUtility.MakeBrowserCacheSafeLayoutsUrl("IntrinsiQ.UserPortal.SharePoint/scripts/portal-mainx.js", false) %>">-->
<!--ME:</script>-->
Result: Invalid SharePoint markup
Script tag surrounded in SharePoint MS/ME tags with Encoding
<!--MS:<script src="<%= Microsoft.SharePoint.Utilities.SPUtility.MakeBrowserCacheSafeLayoutsUrl("IntrinsiQ.UserPortal.SharePoint/scripts/portal-mainx.js", false) %>">-->
<!--ME:</script>-->
Result: Invalid SharePoint markup
ScriptLink tag
<!--MS:<SharePoint:ScriptLink name="<%=Microsoft.SharePoint.Utilities.SPUtility.MakeBrowserCacheSafeLayoutsUrl("IntrinsiQ.UserPortal.SharePoint/scripts/portal-main.js", false)%>" runat="server">-->
<!--ME:</SharePoint:ScriptLink>-->
Result: Invalid SharePoint markup
ScriptLink tag with encoding
<!--MS:<SharePoint:ScriptLink name="<%=Microsoft.SharePoint.Utilities.SPUtility.MakeBrowserCacheSafeLayoutsUrl("IntrinsiQ.UserPortal.SharePoint/scripts/portal-main.js", false)%>" runat="server">-->
<!--ME:</SharePoint:ScriptLink>-->
Result: Invalid SharePoint markup
Note:
I tested the encodings with "<" = < or < and ">", and > or > for good measeure.