相关疑难解决方法(0)

iframe与Electron中的本地资源

我需要iframe在我的Electron应用程序中进行渲染:

<!DOCTYPE html>
<html>
  <head>
    <title></title>
  </head>
  <body>
    <iframe sandbox='allow-scripts' src='frm.html'></iframe>
  </body>
</html>
Run Code Online (Sandbox Code Playgroud)

其中frm.html链接本地文件的脚本foo.js这是我的电子应用程序的一部分

<!DOCTYPE HTML>
<html>
<head>
    <title></title>
    <script src="foo.js"></script>
</head>
<body>
    <p>Inside iframe</p>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

当我在Electron中运行应用程序时,我可以在devtools控制台中看到此错误

Not allowed to load local resource: file:///C:/electron/app1/foo.js
Run Code Online (Sandbox Code Playgroud)

在Electron中是否可能出现这种情况?

iframe electron

4
推荐指数
1
解决办法
8722
查看次数

标签 统计

electron ×1

iframe ×1