Navigation.webidl (2105B)
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 * You can obtain one at http://mozilla.org/MPL/2.0/. 5 * 6 * The origin of this IDL file is 7 * https://html.spec.whatwg.org/multipage/nav-history-apis.html#navigation-interface 8 */ 9 10 [Func="Navigation::IsAPIEnabled", Exposed=Window] 11 interface Navigation : EventTarget { 12 sequence<NavigationHistoryEntry> entries(); 13 readonly attribute NavigationHistoryEntry? currentEntry; 14 [Throws] undefined updateCurrentEntry(NavigationUpdateCurrentEntryOptions options); 15 readonly attribute NavigationTransition? transition; 16 readonly attribute NavigationActivation? activation; 17 18 readonly attribute boolean canGoBack; 19 readonly attribute boolean canGoForward; 20 21 NavigationResult navigate(USVString url, optional NavigationNavigateOptions options = {}); 22 NavigationResult reload(optional NavigationReloadOptions options = {}); 23 24 NavigationResult traverseTo(DOMString key, optional NavigationOptions options = {}); 25 NavigationResult back(optional NavigationOptions options = {}); 26 NavigationResult forward(optional NavigationOptions options = {}); 27 28 attribute EventHandler onnavigate; 29 attribute EventHandler onnavigatesuccess; 30 attribute EventHandler onnavigateerror; 31 attribute EventHandler oncurrententrychange; 32 }; 33 34 dictionary NavigationUpdateCurrentEntryOptions { 35 required any state; 36 }; 37 38 dictionary NavigationOptions { 39 any info; 40 }; 41 42 dictionary NavigationNavigateOptions : NavigationOptions { 43 any state; 44 NavigationHistoryBehavior history = "auto"; 45 }; 46 47 dictionary NavigationReloadOptions : NavigationOptions { 48 any state; 49 }; 50 51 dictionary NavigationResult { 52 Promise<NavigationHistoryEntry> committed; 53 Promise<NavigationHistoryEntry> finished; 54 }; 55 56 enum NavigationHistoryBehavior { 57 "auto", 58 "push", 59 "replace" 60 }; 61 62 // https://html.spec.whatwg.org/multipage/nav-history-apis.html#navigationtype 63 enum NavigationType { 64 "push", 65 "replace", 66 "reload", 67 "traverse" 68 };