- 전체
- HTML
- Web Design (웹디자인)
- XE 응용 개발
- wordpress plugin dev
- Javascript & JavaScript Application
- MEAN Stack : full stack javascript
- angular js & ionic framework
- bootstrap
- WebGL, Three.js and Babylon.js
- restful api design
- mobile web
- node.js 응용
- Cloud Service 응용
- 웹 어셈블리 개발 [WASM, WebAssembly]
- 마이크로서비스, MSA (microservice architecture)
- WebGL / WebGPU
- next.js 개발
- micro frontend (마이크로프론트앤드)
- 전자상거래/쇼핑몰
- 서버 클라우드 (aws, azure, google)
JavaScript [JavaScript] Checking if iframe contents are loaded? : iframe 로딩 완료 이벤트 확인
2024.05.18 00:13
[JavaScript] Checking if iframe contents are loaded? : iframe 로딩 완료 이벤트 확인
[Question]
Checking if iframe contents are loaded?
[Answer]
To be notified when the iFrame is loaded, you can still use the onload event today.
Create the iFrame and set an ID for JavaScript:
<iframe id="test" src="SRC_URL"></iframe>
Now access the iFrame with JavaScript and set an EventListener for the load event:
const iframe = document.getElementById("test");
iframe.addEventListener("load", function() {
console.log("Finish");
});
When the iFrame has finished loading, "Finish" is logged in the console. I have tested it with Google Chrome and it works fine.
Within the EventHandler you can then perform actions. For example, send a message:
iframe.contentWindow.postMessage({ title: "Hi", message: "Seems to work" }, targetOrigin);
Please also make sure that you have permission to embed the web page (X-frame options).
[출처] https://stackoverflow.com/questions/60461930/checking-if-iframe-contents-are-loaded
본 웹사이트는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.

