电子无法获取资源(.swf) [英] Electron unable to fetch resources (.swf)
问题描述
我正在使用电子(使用Pepper Flash插件)将SWF文件直接加载到我的BrowserWindow中。
.swf文件正确加载,但是.swf文件中的代码正在请求单独的资源(例如:something.labels )。
I am using electron (using pepper flash plugin) to load a swf file directly into my BrowserWindow. The .swf file loads correctly but the code inside the .swf file is requesting a seperate resource (eg: something.labels).
由于某种原因,每次即时失败(截图)时,都无法请求 something.labels 文件。我无法弄清楚为什么会发生错误,没有提供详细信息...任何想法?
For some reason the something.labels file cannot be requested, everytime it fails instantly (screenshot). I cannot figure out why the error occurs, no details provided... any ideas?
网络请求
main.js
const { app, BrowserWindow } = require('electron');
const path = require('path');
// Handle creating/removing shortcuts on Windows when installing/uninstalling.
if (require('electron-squirrel-startup')) { // eslint-disable-line global-require
app.quit();
}
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow;
const createWindow = () => {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 800,
height: 900,
titleBarStyle: 'hidden',
resizable: true,
autoHideMenuBar: true,
webPreferences: {
plugins: true
}
});
// and load the index.html of the app.
mainWindow.loadURL('https://example.org/myapplication.swf');
// Open the DevTools.
mainWindow.webContents.openDevTools({ mode: 'detach' });
// Emitted when the window is closed.
mainWindow.on('closed', () => {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null;
});
};
app.commandLine.appendSwitch('ppapi-flash-path', path.join(__dirname, 'pepflashplayer.dll'));
app.commandLine.appendSwitch('ppapi-flash-version', '32.0.0.270');
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow);
// Quit when all windows are closed.
app.on('window-all-closed', () => {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', () => {
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) {
createWindow();
}
});
推荐答案
对于遇到相同问题的每个人。 b $ b这是elctron框架中的错误,版本7中引入
For everyone who is experiencing the same problem.. This is a bug in the elctron framework, introduced in version 7
将您的电子版本更改为6.1。 2将解决此问题
这篇关于电子无法获取资源(.swf)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!