Alex Rivera | Logout

Communicating back to parent from a Webkit notification

Asked 2010-09-07T07:10:10.513
10

I'm using webkitNotifications and createHTMLNotification, etc. to successfully create a notification in Chrome (Windows).

Now I would really like to have the notification window communicate back (or at least set the focus to) the tab/window that created the notification (which is part of the spec). I realize it's still in the early phases for this feature, but I thought maybe someone knows a way. I tried:

window.opener.focus();

from the notification window, but it didn't work.

This page... http://www.thecssninja.com/javascript/web-notifications

says... "Bringing focus back to the window that called the notification, as stated in the proposal by using window.opener.focus(), doesn’t currently work."

I was hoping it was either out of date or that someone might know a workaround.

Thanks for any information you can share.

Jim

Edit
Report

1 Answer

2

I know this question is old, but here's what I'm using to return focus to the window/tab that created a notification:

notification.onclick = function() {window.focus(); this.cancel();}
answered 2012-08-27T15:37:43.870

Your Answer