Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <script type="text/javascript" src="jquery-1.10.2.min.js"></script>
- <script>
- $(function () {
- var result_html = "<html><body>foo</body></html>";
- var type_html = 'text/html';
- var fBlob_html = new Blob([result_html], {type : type_html});
- var fURL_html = window.URL.createObjectURL(fBlob_html);
- var oBlob_html = new Blob([result_html], {type : type_html});
- var oURL_html = window.URL.createObjectURL(oBlob_html);
- // this works
- $("#fResult_html").attr('src', fURL_html);
- // this does not work
- $("#oResult_html").attr('type', type_html);
- $("#oResult_html").attr('data', oURL_html);
- var result_json = '{"foo":bar}';
- var type_json = 'application/json';
- var fBlob_json = new Blob([result_json], {type : type_json});
- var fURL_json = window.URL.createObjectURL(fBlob_json);
- var oBlob_json = new Blob([result_json], {type : type_json});
- var oURL_json = window.URL.createObjectURL(oBlob_json);
- // this works, but complains that the type is not a Document
- $("#fResult_json").attr('src', fURL_json);
- // this does not work
- $("#oResult_json").attr('type', type_json);
- $("#oResult_json").attr('data', oURL_json);
- });
- </script>
- </head>
- <body>
- <iframe id="fResult_html" width="200px" height="200px">
- </iframe>
- <object id="oResult_html" width="200px" height="200px">
- </object>
- <iframe id="fResult_json" width="200px" height="200px">
- </iframe>
- <object id="oResult_json" width="200px" height="200px">
- </object>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement