I am implementing a linqpad util to get the html formatted results from a serialized object, however, it is including it's own CSS in the process when I dump the raw HTML in my view. I want to encapsulate this within an iframe to preserve all of the other CSS.
The issue I am running into is the quotation marks within the string DumpHTML
For context Writes to my model
var writer = LINQPad.Util.CreateXhtmlWriter(true);
writer.Write(objectToSerialize);
strHTML = writer.ToString();
Just dumping the results onto the page
$(function () {
var ifrm = document.getElementById('myIframe');
ifrm = (ifrm.contentWindow) ? ifrm.contentWindow : (ifrm.contentDocument.document) ? ifrm.contentDocument.document : ifrm.contentDocument;
ifrm.document.open();
ifrm.document.write('@Html.Raw(Model.DumpHTML)');
ifrm.document.close();
});
This is what is happening with my output:
$(function () {
var ifrm = document.getElementById('myIframe');
ifrm = (ifrm.contentWindow) ? ifrm.contentWindow : (ifrm.contentDocument.document) ? ifrm.contentDocument.document : ifrm.contentDocument;
ifrm.document.open();
ifrm.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="Generator" content="LINQ to XML, baby!" />
<style type='text/css'>
body
{
margin: 0.3em 0.3em 0.4em 0.5em;
font-family: Verdana;
font-size: 80%;
....
Is there any way around this? Ultimately the issue is all of the auto generated styles are overriding the css on the page.