Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] : webview frame issues #12572

Closed
laciferin2024 opened this issue Jan 30, 2025 · 2 comments
Closed

[bug] : webview frame issues #12572

laciferin2024 opened this issue Jan 30, 2025 · 2 comments
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@laciferin2024
Copy link

Describe the bug

Refused to display 'https://www.google.com/' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

Sandbox access violation: Blocked a frame at "http://localhost:3000" from accessing a frame at "https://www.google.com". The frame being accessed is sandboxed and lacks the "allow-same-origin" flag.

Reproduction

 const webviewRef = useRef<Webview | null>(null);

  useEffect(() => {
    // Create a new window for the webview
    let appWindow = new Window("AppFrameWindow"+appName);

    appWindow = getCurrentWebviewWindow()

    // Generate a unique ID for the webview
    const id = `webview${Math.ceil(Math.random() * 1000)}`;

    // Define the webview options
    const options: WebviewOptions = {
      url: appUrl, // Use the provided appUrl
      x: 0,
      y: 0,
      width: 1024,
      height: 500, // Match the height of the iframe
    };

    // Create the webview
    const webview = new Webview(appWindow, id, options);

    // Store the webview instance in the ref
    webviewRef.current = webview;

    // Handle webview creation and errors
    webview.once("tauri://created", () => {
      console.log("Webview successfully created");
    });

    webview.once("tauri://error", (e) => {
      console.error("Webview error:", e);
    });

    // Cleanup when the component unmounts
    return () => {
      if (webviewRef.current) {
        webviewRef.current.close(); // Close the webview
      }
    };
  }, [appUrl])

Expected behavior

WOrks loads google.com ..

Full tauri info output

Latest

Stack trace


Additional context

No response

@laciferin2024 laciferin2024 added status: needs triage This issue needs to triage, applied to new issues type: bug labels Jan 30, 2025
@FabianLars
Copy link
Member

We cannot "fix"/disable this. If websites don't want to be embedded in iframes then they can't be embedded. An alternative would be the unstable multiwebview feature i guess but that's still very WIP.

@FabianLars FabianLars closed this as not planned Won't fix, can't repro, duplicate, stale Jan 30, 2025
@laciferin2024 laciferin2024 changed the title [bug] : [bug] : webview frame issues Jan 30, 2025
@laciferin2024
Copy link
Author

Yeah, when i do the same from rust , it works

    let webview: Result<tauri::WebviewWindow, tauri::Error> =
        tauri::WebviewWindowBuilder::new(&app, appId.to_string(), tauri::WebviewUrl::External(url))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

2 participants