title: Display HTML String as a web page in a Iframe
body: <p>Here's my Java script code. I want to display my HTML string which is stored in <code>content</code>, I want this to be displayed in the iframe instead it displaying from the src url.</p>
  
  <p>How do I do it.</p>
  
  <p>Code:</p>
  
  <pre><code>if ($("#wikiframe").length == 0) {
                  var s = "";
                  s = getSelText();
                  var content = "&lt;html&gt;" + s + "&lt;/html&gt;";
                  if (s == "") {
                      var s = prompt("Forget something?");
                  }
                  if ((s != "") &amp;&amp; (s != null)) {
                      $("body").append("\
                      &lt;div id='wikiframe'&gt;\
                          &lt;div id='wikiframe_veil' style=''&gt;\
                              &lt;p&gt;Loading...&lt;/p&gt;\
                          &lt;/div&gt;\
                          &lt;iframe src='???' onload=\"$('#wikiframe iframe').slideDown(500);\"&gt;Enable iFrames.&lt;/iframe&gt;\
                          &lt;style type='text/css'&gt;\
                              #wikiframe_veil { display: none; position: fixed; width: 100%; height: 100%; top: 0; left: 0; background-color: rgba(255,255,255,.25); cursor: pointer; z-index: 900; }\
                              #wikiframe_veil p { color: black; font: normal normal bold 20px/20px Helvetica, sans-serif; position: absolute; top: 50%; left: 50%; width: 10em; margin: -10px auto 0 -5em; text-align: center; }\
                              #wikiframe iframe { display: none; position: fixed; top: 10%; left: 10%; width: 80%; height: 80%; z-index: 999; border: 10px solid rgba(0,0,0,.5); margin: -5px 0 0 -5px; }\
                          &lt;/style&gt;\
                      &lt;/div&gt;");
                      $("#wikiframe_veil").fadeIn(750);
                  }
              }
  </code></pre>
  
  <p><code>getSelText</code> would get the string and then I am appending it with <code>&lt;html&gt;</code> and <code>&lt;\html&gt;</code>.</p>
  
  <p>I want this Html code in <code>content</code> to be displayed in the iframe.</p>
  
  <p>How do I do it.</p>
  
  <p>UPDATE:</p>
  
  <p>Please check this JS Fiddle link : I can't figure out why its not working . Added changes as suggested by @mathew.</p>