I have a Google Chrome App that uses a <webview>
component.
Inside the <webview>
, at the URL of the guest, user authentication is handled using a popup and redirect managed by OAuth client in response to a login button onclick
event.
My problem is that when I click my login button, nothing happens. i.e., No popup. No redirect. No login.
How do I fix this to allow the popup and redirect needed by my OAuth implementation?
window.html<!DOCTYPE html>
<html>
<head>
...
</head>
<body>
<webview id="webview" src="https://mywebapp.com"></webview>
</body>
</html>
background.js
chrome.app.runtime.onLaunched.addListener(function() {
runApp();
});
function runApp() {
chrome.app.window.create('window.html', {
state: 'fullscreen'
});
}
var webview = null;
function isSafeUrl(url) {
// This is Hello world test for now; permissions code will go here later
return true;
}
function onPermissionRequest(e) {
e.request.allow();
// This is Hello world test for now; permissions code will go here later
}
function onDomReady() {
webview = document.getElementById('webview');
webview.addEventListener('permissionrequest', onPermissionRequest);
}
document.addEventListener('DOMContentLoaded', onDomReady);