How to make an iframe, where I can set the source code, not just the src? Is it possible to create one without the src?
相关问题
- Views base64 encoded blob in HTML with PHP
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
Also, you can actually write dynamically into the document that you want, like this:
This code opens an output stream (in a new window; about:blank), write some text, then close the output stream.
The open() method opens an output stream to collect the output from any document.write() or document.writeln() methods.
Once all the writes are performed, the document.close() method causes any output written to the output stream to be displayed.
Notes: If a document already exists in the target, it will be cleared. If document.open() isn't called to start writing, every call to write/writeLn will render the content immediately. So for performance reasons it's good to call open and close, in order to begin and end writing. Supported by all major browsers.
References: W3C: document.open
demo
references:
do note that this is bound to the "same-origin policy"