I'm using ASP.NET MVC. I have a view that loads contents of a partial view in a section.
Problem is that partial view has some script references in it. so when I load contents of that partial view in the main page, script tags get removed to protect view against script injection attacks.
I have tried different ways to filter script tags out of partial page content and load theme separately but I was unsuccessful.
For example I have tried to filter script tags and append them in the head of main page like this :
var scripts = $(content).filter('script');
$(scripts).each(function() {
$('head').append($(this));
I have also tried to load those scripts using $.getscript. The function gets executed nicely but they don't appear in page resource in chrome developer tools. and I cannot use functions inside those scripts.
how can I achieve this ??