MarshallOfSound / react-electron-web-view

A simple wrapper to make Electrons WebView compatible with React
MIT License
64 stars 30 forks source link

WebView show nothing #17

Open panda6412 opened 5 years ago

panda6412 commented 5 years ago

I am simply using webView, but show nothing, I have no idea what's happened

import React from 'react';
import logo from './logo.svg';
import './App.css';
import WebView from 'react-electron-web-view'
function App() {
  return (
    <div className="App">
      <h1>why not?</h1>
      <WebView src="https://www.google.com" />
    </div>
  );
}

export default App;
tchesa commented 5 years ago

@panda6412 try to set the webviewTag attribute to true when initialize your BrowserWindow on your main electron file.

mainWindow = new BrowserWindow({
  width: 900,
  height: 680,
  webPreferences: {
    webviewTag: true
  }
})
stychu commented 5 years ago

Yeah. ! Was looking to this for 2 hrs... what the hell. @tchesa thanks ;)

13r0ck commented 4 years ago

@stychu Still after a year your comment is still saving lives. THANK YOU!!!!

RobinJ1995 commented 3 years ago

This should be added to the README, to say the least...