Html5 Web Notifications User Control

Unofficial Content

'Web Notification' user control allows the user to send messages that can be displayed even when the browser is minimized. It is useful when you want to notify users about relevant messages.
Each notification has a title, message and can have an icon to be displayed.

User must grant permission in order to work properly.


HTML5 Web Notifications is supported in Google Chrome and Safari only.


Icon The image to be display inside the message container.
Duration The seconds that the message will be displayed. 0: means forever). Default: 8 seconds.
PermissionPromptMessage Web Notifications requires the user to grant permission. This message will be displayed within client screen in order to invite the user to grant permission.


ShowMessage Character: Title, Character: message body


OnShow Fired when message is shown to user.
OnClose Fired when message is closed by user.
OnClick Fired when message is clicked by user.

Code Snippet

Event Start
	WebNotification1.Icon = ""

Event Enter
	WebNotification1.ShowMessage("Message Title","Message Body")

Event WebNotification1.OnClose
	msg("Notification was closed!")

Event WebNotification1.OnShow
	msg("Notification was shown!")

Event WebNotification1.OnClick
	msg("Notification was clicked!")

Note that the most common use of this user control is within the OnMessage event, see Server.Socket external object for more information.
The following example shows how the notification message is captured in a web panel and displayed using the Web Notification user control.

Event OnMessage(&NotificationInfo) //&NotificationInfo is NotificationInfo data type.
  if (& = "Reservation confirmed")
          webNotification1.ShowMessage("Reservation Confirmation",&NotificationInfo.Message) //webNotification1 is the user control name.



Under the hood it uses Web Notifications (part of the HTML5 standard). It's only implemented in Google Chrome for now. So Google Chrome or Safari is required in order to work properly.

Download the user control from here.