Skip to content

Adding opening tab on click notification #12

@nikminer

Description

@nikminer

Add the ability to open a tab or window to a new page when clicking on a notification, as in the documentation example

https://developer.mozilla.org/en-US/docs/Web/API/Notification/click_event

You can add the url property to the NotificationOptions class.

Then in script.js change the opening function create like:

export function create(title, options) {
    var notify = new Notification(title, options);
    if (options.URL != null) {
        notify.onclick = (event) => {
            event.preventDefault();
            window.open(options.url, "_blank");
            event.target.close(); // close notifycation
        };
    }
    return notify;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions