tauri icon indicating copy to clipboard operation
tauri copied to clipboard

[bug] Can't not load some webpages in iframe

Open tufik2 opened this issue 1 year ago • 5 comments

Describe the bug

I am creating an app to show content from different resources, one of those resources is any web, but when I try to create a window and set the user URL inside a iframe that is refused. Any idea how to fix it, or it is possible to do that, or is it not a good idea to use Tauri for this kind of app?

My configuration is

tauri.conf.json

"security": {
      "csp": "default-src 'self'; frame-src *; sandbox allow-downloads allow-presentation;"
    },

And inside my .js I am creating a new window, that window has an iframe inside that tries to load the external content...

 new WebviewWindow(label, {url:'app/window/browser.html'})

browser.html

<iframe src="${this.config.url}" allowfullscreen allowtransparency="allowtransparency" ></iframe>

And this is the error Screenshot 2023-05-19 at 12 54 46 PM

Reproduction

No response

Expected behavior

No response

Platform and versions

MacOS - Lastest version

tufik2 avatar May 19 '23 16:05 tufik2

我现在就是http嵌套web 一直被拒绝访问 有什么办法解决在iframe内嵌时候

wfc66986 avatar May 26 '23 09:05 wfc66986

I also encountered the same problem

ghost avatar Sep 12 '23 05:09 ghost

Any update on this or anyone has a work around?

0xDevrim avatar Feb 15 '24 10:02 0xDevrim

No, I talked in the Discord Channel, and apparently, they don't have this in their roadmap. ElectronJS supports a tag named WEBVIEW to embed external web content without the IFRAME limitations... In my development project this feature is a must so sadly I had to switch to a more mature framework like ElectronJS. I hope they support it someday.

tufik2 avatar Feb 15 '24 16:02 tufik2

https://beta.tauri.app/blog/tauri-2-0-0-beta/#multiwebview - working on it. It won't ever match the electron webview tag but it should still cover most of the same use cases.

FabianLars avatar Feb 15 '24 17:02 FabianLars