0

I am creating a preview for users entering html but I am having problems sharing the html across an iframe.

I have the following javascript

$(function () {
    var pathname =  "https://" + document.domain + "/newspreview.aspx";
    localStorage.contents = $("#<%=Content.ClientID%>").val();
    $("#preview").attr("src", pathname);
});

and the html is

<iframe id="preview" style="border:2px solid; width:880px;height:600px;" >

  </iframe> 

on the newspreview.aspx page I have the javascript below, all I get displayed is undefined. Has anybody got any ideas why this is the case. (BTW both pages are using https)

 <script type="text/javascript" language="javascript">
         var result = localStorage.contents;
         document.write(result);
         localStorage.removeItem("contents");
</script>

Regards

Podge

4

0 回答 0