I am trying to set a webview's source using a local file.
Manifest:
"webview": {
"partitions": [{
"name": "static",
"accessible_resources": [
"sandbox/sandbox.html",
"sandbox/sandbox.js",
"sandbox/sandbox.css",
]
}]
},
Set Webview's source
var webviewSrc = chrome.runtime.getURL('sandbox/sandbox.html');
//console.log prints chrome-extension://MY_CHROME_APP_ID/sandbox/sandbox.html
webviewEl = <webview id="webview" ref="Webview" src={webviewSrc} partition="static"></webview>
Error:
<webview>: The load has aborted with error -109: ERR_ADDRESS_UNREACHABLE.
Why is it happening, and how do I fix this issue?
This setting works:
/foreground/main.html
<html>
<head>
<link rel="stylesheet" type="text/css" href="./bundle/app.css">
<link rel="stylesheet" type="text/css" href="./main.css">
</head>
<body>
<div id="app"></div>
<div id="webview-container">
<webview id="youtube-webview" src="sandbox/sandbox.html" partition="static"></webview>
</div>
<script src="./bundle/app.js"></script>
</body>
</html>
/sandbox/sandbox.html
Hello
This setting returns 'address unreachable' error:
/foreground/main.html
<html>
<head>
<link rel="stylesheet" type="text/css" href="./bundle/app.css">
<link rel="stylesheet" type="text/css" href="./main.css">
</head>
<body>
<div id="app"></div>
<script src="./bundle/app.js"></script> <-- initialize webview inside here
</body>
</html>
/sandbox/sandbox.html
Hello
/foreground/bundle/app.js
var webviewSrc = chrome.runtime.getURL('sandbox/sandbox.html');
// or var webviewSrc = 'sandbox/sandbox.html';
webviewEl = _react2.default.createElement("webview", { id: "webview", ref: "Webview", src: webviewSrc, partition: "static" });
// ADDRESS_UNREACHABLE