小编Fre*_*iel的帖子

阻止了源为“file://”的框架访问跨源框架

将电子从 4.1.4 升级到 5.0.0 后,出现此错误

阻止了来源为“file://”的框架访问跨源框架。在 HTMLIFrameElement.preload (renderer.js:31:78)

new BrowserWindow({ webPreferences })此处添加,但此错误仍然存​​在。

这是我的 index.html

<html>
<head>
    <meta charset="UTF-8">
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/>
</head>
<body>
    <iframe data-bind="visible: showIframe, attr:{src:appUrl}" allow="autoplay; geolocation; microphone; camera" allowfullscreen></iframe>
</body>
<script>
    require('./renderer.js');
</script>
</html>
Run Code Online (Sandbox Code Playgroud)

这是 main.js 中的一些代码

  const {
    autoUpdater
  } = require('electron-updater');
  const platform = require('os').platform();
  const electron = require('electron');
  const fs = require('fs-extra');
  const CronJob = require('cron').CronJob;
  const {
    app,
    BrowserWindow,
    Tray,
    Menu,
    ipcMain
  } = electron;
  const path …
Run Code Online (Sandbox Code Playgroud)

javascript electron

10
推荐指数
2
解决办法
3908
查看次数

如何从Electron BrowserWindow对象获取当前URL?

我想知道browser-window的当前 URL 。有没有办法访问 BrowserWindow 的 window.location.href 属性或任何其他方式来获取它?

javascript electron

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

标签 统计

electron ×2

javascript ×2