Reputation: 6142
I have been following the Google Chrome Extensions Developer's guide and have been able so far to create an extension with a browser action without popup that would trigger a webkit notification in HTML format.
Fact is that this HTML file contains action buttons, links and javascript, but none of them seems to respond.
Is this a by-design behavior or is there a way for embedding javascript/links/buttons in these webkit notifications?
EDIT:
Here are some new insights on the subject:
Here is an HTML notification page that doesn't work:
<html>
<head>
<script>
alert("hey");
</script>
</head>
<body>
content
</body>
</html>
As a result, the notification is all blank ; the text "content" isn't displayed.
But if I remove the "alert", the text "content" is displayed.
I first thought that Javascript was blocking the page from rendering correctly, but I tried something else:
<script>document.write("content");</script>
This javascript command is correctly executed and displays the text "content". We can then assume that Javascript is enabled even in the webkit desktop notifications, but the "alert" function is disabled, and breaks the rendering of the notification page.
Some links work, some don't. Here is a quick list of those I've tested so far:
<a href="http://www.google.com/">Link</a> # => Doesn't work
<a href="http://www.google.com/" target="_top">Link</a> # => Doesn't work
<a href="http://www.google.com/" target="_parent">Link</a> # => Doesn't work
<a href="http://www.google.com/" target="_blank">Link</a> # => Works (new tab)
Upvotes: 4
Views: 3746
Reputation: 10059
UPDATE: createHTMLNotification()
has been removed from the draft spec and also from Chrome, so this will no longer work.
The closest thing is an onclick
handler on the whole notification window. It's less discoverable (doesn't look like a link), and I haven't tested if it's possible to navigate to a link from it.
Upvotes: 2
Reputation: 6142
It's all explained in the Chromium Desktop Notifications API Specification where it's clearly said that:
If a user agent implements createHTMLNotification, it should show HTML notifications as independent browsing contexts which are equivalent in functionality to any other HTML web page, except with the following properties:
- The notification cannot be navigated. The Location attribute of the window object in the notification context should be readonly. All links should open in new, non-notification browsing contexts.
- If close() is invoked on the window object in the notification context in response to a user gesture, the user agent should proceed as if the user closed the notification, including all required event processing.
Upvotes: 2