Zeroing notifications through the Google Chrome App Webview

I have a packaged Google Chrome app and use the webview tag to load a remote page (which I do not control). This remote page is trying to request privilege notifications and that the permission request does not seem to get into the Chrome app for packaging.

I use the following (overly permissive) code to allow all permission requests from webview (and echo all consoles):

webview.addEventListener('permissionrequest', function(e) { console.log("webview requested " + e.permission); e.request.allow(); }); webview.addEventListener('consolemessage', function(e) { console.log('From webview: ', e.message); }); 

I cannot find confirmation on the Internet, but I think that display permissions are not yet allowed in web views. If we assume that this is the case, are there any other ways to potentially force permission to a website that CORS will not block?

+5
source share
1 answer

You are right ( as far as documents go ) that requests for permission to notifications do not exist, and there is no event to indicate that the notification wants to be shown.

What you could do is add a script content, which in turn will introduce a page level script level that replaces the Notification object with a message that passes to your script content that passes it to your application, which can display notification using chrome.notifications . Here's the answer explaining this injection in more detail.

+1
source

Source: https://habr.com/ru/post/1200275/


All Articles