javascript - Passing a link via viewbag MVC RAZOR & appearing -
I'm trying to pass from my view to see a view from my controller, link to form of source To be used in an iframe however & amp; It appears that LNK does not work
Controller
link = "http://example.com/Index?aa=aa&q=bb"; ViewBag.Answer3 = link;
View
& lt; Iframe height = "30" id = "audio" src = "" & gt; & Lt; Script & gt; Show Function () {var listen = document.getElementById ("Audio"); Listen.src = "@ ViewBag.Answer3"; ...
However this does not work and when I look at the debugger, I see it
listen.src = "http: // example? .com / index aa = a & amp; q = q = bb ";
Your help tom
The razor automatically for HTML Thanks you can output to any string.
You can stop it with Html.Raw ()
.
However, you must javascript-encode for quotation marks instead.
Comments
Post a Comment