描述
electron使用BrowserWindow打开子页面时,
父窗口提示ERR_FILE_NOT_FOUND
,
子窗口提示'Not allowed to load local resource',
网络则提示'(blocked:other)';
分析
这个应该是浏览器的安全限制;
如上图, 如果主窗口加载index.html
, 使用子窗口加载同级的index2.html
时, 没有问题,
但是如果加载同级目录sub
下的index3.html
, 可能被认为是跨域而阻止;
解决
在index.html
目录中写一个跳转页面, 传入需要跳转的地址, 在该页中用window.location.href
进行跳转;