Files
kiss-translator/src/libs/iframe.js

12 lines
337 B
JavaScript
Raw Normal View History

2023-08-26 11:43:00 +08:00
export const isIframe = window.self !== window.top;
export const sendIframeMsg = (action, args) => {
document.querySelectorAll("iframe").forEach((iframe) => {
2023-08-26 11:43:00 +08:00
iframe.contentWindow.postMessage({ action, args }, "*");
});
};
2023-09-17 20:45:05 +08:00
2023-10-12 17:00:18 +08:00
export const sendParentMsg = (action, args) => {
2023-09-17 20:45:05 +08:00
window.parent.postMessage({ action, args }, "*");
};