-
It seems that the iframe embedded in tauri will not inject some global functions into the window, such as Is there any other way to let the page embedded in the iframe use Tauri's API? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
The issue has been resolved. Just recording my own solution for future reference: If your // Override the __TAURI_IPC__ function
window.__TAURI_IPC__ = (args) => {
//The parent window callback points to the child window
window.parent[`_${args.callback}`] = window[`_${args.callback}`];
// Call the function of the parent window
window.parent.__TAURI_IPC__(args);
}; First, However, the |
Beta Was this translation helpful? Give feedback.
-
Is there any similar way to do it in v2? |
Beta Was this translation helpful? Give feedback.
The issue has been resolved. Just recording my own solution for future reference:
If your
iframe
andmain window
have the same domain name, then this may be a good method(Add the following code to the very top ofiframe
js initialization):First,
Tauri
will mount the globalwindow.__TAURI_IPC__
in themain window
by default, but there is no such function in the childiframe
. However, many of Tauri's APIs are…