Javascript Electron无法获取资源(.swf)
我正在使用electron(使用pepper flash插件)将swf文件直接加载到我的浏览器窗口中。 .swf文件加载正确,但.swf文件中的代码正在请求单独的资源(例如:something.labels) 由于某些原因,something.labels文件无法被请求,每次它都会立即失败(屏幕截图)。我无法找出错误发生的原因,没有提供详细信息。。。有什么想法吗 网络请求 main.jsJavascript Electron无法获取资源(.swf),javascript,node.js,flash,electron,Javascript,Node.js,Flash,Electron,我正在使用electron(使用pepper flash插件)将swf文件直接加载到我的浏览器窗口中。 .swf文件加载正确,但.swf文件中的代码正在请求单独的资源(例如:something.labels) 由于某些原因,something.labels文件无法被请求,每次它都会立即失败(屏幕截图)。我无法找出错误发生的原因,没有提供详细信息。。。有什么想法吗 网络请求 main.js const { app, BrowserWindow } = require('electron'); c
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();
}
});
对于遇到相同问题的每个人。。 这是7版中引入的elctron框架中的一个缺陷
将您的electron版本更改为6.1.2将解决此问题不知道-但对于测试,我会在创建
浏览器窗口
实例时尝试设置:false。@NoGrabbing是一个很好的尝试,但不起作用
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();
}
});