6

I have a Google Chrome Packaged App and uses a webview tag to load a remote page (that I don't control). That remote page is trying to request notification privileges and that permissions request doesn't seem to be bubbling up through to the wrapping Chrome App.

I'm using the following (overly permissive) code to allow all permission requests from the webview (and echo all console output):

  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 can't find confirmation online, but I'm thinking notification permissions are not yet allowed in webviews. If we assume that is the case, are there any other ways to potentially force notification permission for the webview'ed site that won't be blocked by CORS?

Zenexer
  • 18,788
  • 9
  • 71
  • 77
Mike Flynn
  • 2,153
  • 16
  • 22
  • Notifications are working fine on my Chromebook without any extra code. I didn't see any notification-related permissions when snooping around internal code, but it does look like they have some new permission/action requests lined up for future versions, such as for context menus. – Zenexer Jul 03 '15 at 13:53
  • Any progress on this? – HaNdTriX May 03 '16 at 18:05

1 Answers1

2

You are correct (as far as the docs go) that notification permission requests don't exist, nor there is any event to indicate that a notification wants to be shown.

What you could conceivably do is to inject a content script that will, in turn, inject a page-level script that replaces the Notification object with something that passes a message to your content script, which relays it to your app, which can show the notification using chrome.notifications. Here's an answer that explains this injection in more detail.

Community
  • 1
  • 1
Xan
  • 74,770
  • 16
  • 179
  • 206