Skip to content

Truly independent web browser

1.7 KB
Raw Blame
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#navigation-interface
[Exposed=Window]
interface Navigation : EventTarget {
    sequence<NavigationHistoryEntry> entries();
    readonly attribute NavigationHistoryEntry? currentEntry;
    undefined updateCurrentEntry(NavigationUpdateCurrentEntryOptions options);
    [DirectGetter] readonly attribute NavigationTransition? transition;
    [DirectGetter] readonly attribute NavigationActivation? activation;

    readonly attribute boolean canGoBack;
    readonly attribute boolean canGoForward;

    [NeedsCallerRealm] NavigationResult navigate(USVString url, optional NavigationNavigateOptions options = {});
    [NeedsCallerRealm] NavigationResult reload(optional NavigationReloadOptions options = {});

    [NeedsCallerRealm] NavigationResult traverseTo(DOMString key, optional NavigationOptions options = {});
    [NeedsCallerRealm] NavigationResult back(optional NavigationOptions options = {});
    [NeedsCallerRealm] NavigationResult forward(optional NavigationOptions options = {});

    attribute EventHandler onnavigate;
    attribute EventHandler onnavigatesuccess;
    attribute EventHandler onnavigateerror;
    attribute EventHandler oncurrententrychange;
};

dictionary NavigationUpdateCurrentEntryOptions {
    required any state;
};

dictionary NavigationOptions {
    any info;
};

dictionary NavigationNavigateOptions : NavigationOptions {
    any state;
    NavigationHistoryBehavior history = "auto";
};

dictionary NavigationReloadOptions : NavigationOptions {
    any state;
};

dictionary NavigationResult {
    Promise<NavigationHistoryEntry> committed;
    Promise<NavigationHistoryEntry> finished;
};

enum NavigationHistoryBehavior {
    "auto",
    "push",
    "replace"
};