I am creating a Javascript file that will be embedded onto a 3rd party site. The Javascript file will render some content onto the third party site. The idea is the same as Google Adsense – web site owner places a JS file on their site, and some advertisements appear in that location.
I am open to alternative methods, but I am trying to accomplish this by having the embedded JS file simply do:
document.write(‘Advertisement content’)
However, my advertisement content is embedded in ASP.NET MVC3 partial view. How can I escape the content returned from the Html.Partial method to a valid JS string?
I’m looking for something like:
document.write(@Html.JavascriptEscapedPartial(“/Shared/_AdContent”))
1 Answer