Hi all!
I am experience a very stange issue.
I have a set of static classes which I use to manage some Urls with. I am trying to render one of these Urls as a parameter for a javascript file.
For e.g. in my MasterLayout.cshtml for my C1 Page, I have the following snippet (note that it is surrounded by CDATA)
I thought that the CDATA wrapper would stop this. The stranger thing is, when I manually put the Url into my master layout, like so:
Is Composite somehow intercepting the string return from my helper method and doing a transform on the string?? Wizardry! I am at a loss for explanations here.
Has anyone else out there experienced something like this?
I am experience a very stange issue.
I have a set of static classes which I use to manage some Urls with. I am trying to render one of these Urls as a parameter for a javascript file.
For e.g. in my MasterLayout.cshtml for my C1 Page, I have the following snippet (note that it is surrounded by CDATA)
<![CDATA[
<script type="text/javascript">
MyJavascript.Widget.init({
widgetSourceUrl: "@(MyUrlHelper.WidgetSourceUrl())"
});
</script>
]]>
The helper has a source similar to:public static class MyUrlHelper
{
public static string WidgetSourceUrl()
{
return "/widget/source?param1=foo¶m2=bar";
}
}
However, once rendered, the html output becomes:<script type="text/javascript">
MyJavascript.Widget.init({
widgetSourceUrl: "/widget/source?param1=foo&param2=bar"
});
</script>
The & got parsed into a &I thought that the CDATA wrapper would stop this. The stranger thing is, when I manually put the Url into my master layout, like so:
<script type="text/javascript">
<![CDATA[
MyJavascript.Widget.init({
widgetSourceUrl: "/widget/source?param1=foo¶m2=bar"
});
]]>
</script>
It actually renders the output correctly as:<script type="text/javascript">
MyJavascript.Widget.init({
widgetSourceUrl: "/widget/source?param1=foo¶m2=bar"
});
</script>
???? confused face!Is Composite somehow intercepting the string return from my helper method and doing a transform on the string?? Wizardry! I am at a loss for explanations here.
Has anyone else out there experienced something like this?