10 examples of 'react iframe onload' in JavaScript

Every line of 'react iframe onload' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
166function iframeOnload() {
167 // 移除提交数据用的表单和iframe
168 if (div.parentNode) { div.parentNode.removeChild(div); }
169 // 释放全局回调函数
170 if (callbackName) { base.deleteGlobalVar(callbackName); }
171
172 onload('success');
173}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

209onLoadIframe() {
210 console.log("iframe onload");
211 let iframe = document.querySelector('#iframe') as HTMLIFrameElement
212 if (iframe.src == 'http://localhost:3000/') {
213 iframe.style.display = "none";
214 } else {
215 iframe.style.display = "block";
216 (document.querySelector('#loading') as HTMLElement).style.display = "none";
217 (document.querySelector('mat-progress-bar') as HTMLElement).style.display = "none";
218 }
219
220}
20componentDidMount() {
21 this.setIframeContent(this.props.value)
22}
4componentDidMount() {
5 const host = window.location.host;
6
7 let assets = {
8 css: '/s.css',
9 js: '/s.js',
10 };
11
12 if (/(127\.0\.0\.1)|localhost/ig.test(host)) {
13 assets = {
14 css: 'http://localhost:8000/index.css',
15 js: 'http://localhost:8000/index.js',
16 };
17 }
18
19 const html = `<!DOCTYPE html>
20 <html lang="en">
21 <head>
22 <meta charset="UTF-8">
23 <meta name="viewport" content="width=device-width, initial-scale=1">
24 <title>Ant Design Admin</title>
25 <link rel="stylesheet" href="${assets.css}"/>
26 </head>
27 <body>
28 <div id="root"></div>
29 <script src="${assets.js}"></script>
30 </body>
31 </html>`;
32
33 this.node.contentWindow.document.write(html);
34 this.node.contentWindow.document.close();
35}
24export function createIframe(onIframeLoad) {
25 var iframe = document.createElement('iframe');
26 iframe.class = 'react-playground-preview-iframe';
27 iframe.src = 'about:blank';
28 iframe.style.border = 'none';
29 iframe.style.zIndex = 2147483647;
30 iframe.style.margin = 0;
31 iframe.style.padding = 0;
32 iframe.style.width = '100%';
33 iframe.onload = onIframeLoad;
34 return iframe;
35}
86onLoad_() {
87 const iframeElem = this.iframeElem_;
88
89 const src = iframeElem.attr('src');
90 if (!src) {
91 // Ignore unwanted load event that is fired when appending to DOM
92 return;
93 }
94 if (src === IframeContent.EMPTY_SRC) {
95 return;
96 }
97
98 const elem = this.getFlexibleElement();
99 elem.width(this.preferredWidth_);
100 elem.height(this.preferredHeight_);
101
102 this.onComplete_(true);
103}
57iframeTo(src) {
58 this.setState({'iframe':src})
59 }
89function iframe_reload() {
90 var iframe = document.getElementsByTagName('iframe')[0];
91
92 ractive.set('iframe_set_offset', true);
93 iframe.contentWindow.location.reload(true);
94}
13componentDidMount() {
14 // can't update until we have a mounted iframe
15 this.updateIframe(this.props);
16 this.resizeIframe(this.props);
17}
36function reloadIframe(id) {
37 document.getElementById(id).contentWindow.location.reload();
38}

Related snippets