Vue-cli-plugin-electron-builder: webview tag doesn't work

Created on 12 Sep 2019  路  1Comment  路  Source: nklayman/vue-cli-plugin-electron-builder

Describe the bug

Webview tag shows a blank page.

To Reproduce
Steps to reproduce the behavior:

  1. Init with Vue CLI, use default configs
  2. Add vcp to project
  3. Replace App.vue template with webview tag
<template>
  <div id="app">
    <webview
      id="foo"
      src="https://www.github.com/"
      style="display:inline-flex; width:640px; height:480px"
    ></webview>
  </div>
</template>
  1. yarn electron:serve

Expected behavior
The window shows the github page.

Screenshots
image

Environment (please complete the following information):

  • OS and version: win 10 1903
  • node version: 10.15.3
  • yarn version: 1.17.3
  "dependencies": {
    "core-js": "^2.6.5",
    "vue": "^2.6.10"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "^3.11.0",
    "@vue/cli-plugin-eslint": "^3.11.0",
    "@vue/cli-service": "^3.11.0",
    "babel-eslint": "^10.0.1",
    "electron": "^5.0.0",
    "eslint": "^5.16.0",
    "eslint-plugin-vue": "^5.0.0",
    "vue-cli-plugin-electron-builder": "^1.4.0",
    "vue-template-compiler": "^2.6.10"
  },
  • custom config for vcp-electron-builder: none

Most helpful comment

You now need to explicitly enable webviewTag in your webPreferences object.

const mainWindow = new BrowserWindow({
  webPreferences: {
    webviewTag: true
  }
})

https://electronjs.org/docs/api/webview-tag

>All comments

You now need to explicitly enable webviewTag in your webPreferences object.

const mainWindow = new BrowserWindow({
  webPreferences: {
    webviewTag: true
  }
})

https://electronjs.org/docs/api/webview-tag

Was this page helpful?
0 / 5 - 0 ratings