Class Navigation
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
NOTE
ExperimentalNavigation interface of the {{domxref("Navigation API", "Navigation API", "", "nocode")}} allows control over all navigation actions for the current window in one central place, including initiating navigations programmatically, examining navigation history entries, and managing navigations as they happen.
[Value("Navigation")]
public class Navigation : EventTarget
- Inheritance
-
Navigation
- Inherited Members
Remarks
It is accessed via the Navigation property.
The Navigation API only exposes history entries created in the current browsing context that have the same origin as the current page (e.g., not navigations inside embedded iframes, or cross-origin navigations), providing an accurate list of all previous history entries just for your app. This makes traversing the history a much less fragile proposition than with the older {{domxref("History API", "History API", "", "nocode")}}.
-Modern client-side routing: the Navigation API
-Navigation API explainer
-Navigation API live demo (view demo source)
Constructors
Navigation()
public Navigation()
Properties
Activation
NOTE
Experimentalactivation read-only property of the Navigation interface returns a NavigationActivation object containing information about the most recent cross-document navigation, which "activated" this Document. The property will stay constant during same-document navigations.
[Value("activation")]
public NavigationActivation? Activation { get; }
Property Value
- NavigationActivation
A NavigationActivation object, or
nullif current document is the initialabout:blankdocument.
Remarks
CanGoBack
NOTE
ExperimentalcanGoBack read-only property of theNavigation interface returns
trueif it is possible to navigate backwards in the navigation history
(i.e., the CurrentEntry is
not the first one in the history entry list),
and
false if it is not.
[Value("canGoBack")]
public bool CanGoBack { get; }
Property Value
- bool
A boolean value:
trueif it is possible to navigate backwards in the navigation history,falseotherwise.
Remarks
CanGoForward
NOTE
ExperimentalcanGoForward read-only property of theNavigation interface returns
true if it is possible to navigate forwards in the navigation history(i.e., the CurrentEntry is not the last one in the history entry list),
and
false if it is not.
[Value("canGoForward")]
public bool CanGoForward { get; }
Property Value
- bool
A boolean value:
trueif it is possible to navigate forwards in the navigation history,falseotherwise.
Remarks
CurrentEntry
NOTE
ExperimentalcurrentEntry read-only property of theNavigation interface returns a NavigationHistoryEntry object representing the location the user is currently navigated to right now.
[Value("currentEntry")]
public NavigationHistoryEntry? CurrentEntry { get; }
Property Value
- NavigationHistoryEntry
A NavigationHistoryEntry object.
Remarks
Oncurrententrychange
[Value("oncurrententrychange")]
public EventHandlerNonNull Oncurrententrychange { get; set; }
Property Value
Onnavigate
[Value("onnavigate")]
public EventHandlerNonNull Onnavigate { get; set; }
Property Value
Onnavigateerror
[Value("onnavigateerror")]
public EventHandlerNonNull Onnavigateerror { get; set; }
Property Value
Onnavigatesuccess
[Value("onnavigatesuccess")]
public EventHandlerNonNull Onnavigatesuccess { get; set; }
Property Value
Transition
NOTE
Experimentaltransition read-only property of the Navigation interface returns a NavigationTransition object representing the status of an in-progress navigation, which can be used to track it.
[Value("transition")]
public NavigationTransition? Transition { get; }
Property Value
- NavigationTransition
A NavigationTransition object, or
nullif no navigation is currently in progress.
Remarks
Methods
Back(NavigationOptions)
NOTE
Experimentalback() method of theNavigation interface navigates backwards by one entry in the navigation history.
[Value("back")]
public NavigationResult Back(NavigationOptions options = null)
Parameters
optionsNavigationOptions
Returns
- NavigationResult
An object with the following properties:Either one of these promises rejects if the navigation has failed for some reason.
Remarks
Entries()
NOTE
Experimentalentries() method of theNavigation interface returns an array of NavigationHistoryEntry objects representing all existing history entries.
[Value("entries")]
public List<NavigationHistoryEntry> Entries()
Returns
- List<NavigationHistoryEntry>
An array of NavigationHistoryEntry objects.
Remarks
Forward(NavigationOptions)
NOTE
Experimentalforward() method of theNavigation interface navigates forwards by one entry in the navigation history.
[Value("forward")]
public NavigationResult Forward(NavigationOptions options = null)
Parameters
optionsNavigationOptions
Returns
- NavigationResult
An object with the following properties:Either one of these promises rejects if the navigation has failed for some reason.
Remarks
Navigate(string, NavigationNavigateOptions)
NOTE
Experimentalnavigate() method of theNavigation interface navigates to a specific URL, updating any provided state in the history entries list.
[Value("navigate")]
public NavigationResult Navigate(string url, NavigationNavigateOptions options = null)
Parameters
urlstringoptionsNavigationNavigateOptions
Returns
- NavigationResult
An object with the following properties:Either one of these promises rejects if the navigation has failed for some reason.
Remarks
Reload(NavigationReloadOptions)
NOTE
Experimentalreload() method of theNavigation interface reloads the current URL, updating any provided state in the history entries list.
[Value("reload")]
public NavigationResult Reload(NavigationReloadOptions options = null)
Parameters
optionsNavigationReloadOptions
Returns
- NavigationResult
An object with the following properties:Either one of these promises rejects if the navigation has failed for some reason.
Remarks
TraverseTo(string, NavigationOptions)
NOTE
ExperimentaltraverseTo() method of the Navigation interface navigates to the NavigationHistoryEntry identified by the given Key.
[Value("traverseTo")]
public NavigationResult TraverseTo(string key, NavigationOptions options = null)
Parameters
keystringoptionsNavigationOptions
Returns
- NavigationResult
An object with the following properties:Either one of these promises rejects if the navigation has failed for some reason.
Remarks
UpdateCurrentEntry(NavigationUpdateCurrentEntryOptions)
NOTE
ExperimentalupdateCurrentEntry() method of the Navigation interface updates the state of the CurrentEntry; used in cases where the state change will be independent of a navigation or reload.
[Value("updateCurrentEntry")]
public GlobalObject.Undefined UpdateCurrentEntry(NavigationUpdateCurrentEntryOptions options)
Parameters
Returns
- GlobalObject.Undefined
None (
undefined).