History class
History object, which provides an interface for manipulating the browser session history (pages visited in the tab or frame that the current page is loaded in).
@DomName('History')
class History implements HistoryBase native "History" {
/**
* Checks if the State APIs are supported on the current platform.
*
* See also:
*
* * [pushState]
* * [replaceState]
* * [state]
*/
static bool get supportsState => JS('bool', '!!window.history.pushState');
@DomName('History.length')
@DocsEditable
final int length;
dynamic get state => _convertNativeToDart_SerializedScriptValue(this._get_state);
@JSName('state')
@DomName('History.state')
@DocsEditable
@annotation_Creates_SerializedScriptValue
@annotation_Returns_SerializedScriptValue
final dynamic _get_state;
@DomName('History.back')
@DocsEditable
void back() native;
@DomName('History.forward')
@DocsEditable
void forward() native;
@DomName('History.go')
@DocsEditable
void go(int distance) native;
@DomName('History.pushState')
@DocsEditable
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.FIREFOX)
@SupportedBrowser(SupportedBrowser.IE, '10')
@SupportedBrowser(SupportedBrowser.SAFARI)
void pushState(Object data, String title, [String url]) native;
@DomName('History.replaceState')
@DocsEditable
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.FIREFOX)
@SupportedBrowser(SupportedBrowser.IE, '10')
@SupportedBrowser(SupportedBrowser.SAFARI)
void replaceState(Object data, String title, [String url]) native;
}
Extends
Interceptor > History
Implements
Static Properties
Properties
final int hashCode #
Get a hash code for this object.
All objects have hash codes. Hash codes are guaranteed to be the
same for objects that are equal when compared using the equality
operator ==. Other than that there are no guarantees about
the hash codes. They will not be consistent between runs and
there are no distribution guarantees.
If a subclass overrides hashCode it should override the
equality operator as well to maintain consistency.
int get hashCode => Primitives.objectHashCode(this);
final int length #
1.
final int length
final Type runtimeType #
A representation of the runtime type of the object.
Type get runtimeType => getRuntimeType(this);
final state #
dynamic get state => _convertNativeToDart_SerializedScriptValue(this._get_state);
Operators
bool operator ==(other) #
The equality operator.
The default behavior for all Objects is to return true if and
only if this and
other are the same object.
If a subclass overrides the equality operator it should override
the hashCode method as well to maintain consistency.
bool operator ==(other) => identical(this, other);
Methods
void back() #
Goes to the previous page in session history, the same action as when the user clicks the browser's Back button. Equivalent to history.go(-1).
@DomName('History.back')
@DocsEditable
void back() native;
void forward() #
Goes to the next page in session history, the same action as when the user clicks the browser's Forward button; this is equivalent to history.go(1).
@DomName('History.forward')
@DocsEditable
void forward() native;
void go(int distance) #
-1 for the previous page or 1 for the next page. When integerDelta is out of bounds (e.g. -1 when there are no previously visited pages in the session history), the method doesn't do anything and doesn't raise an exception. Calling go() without parameters or with a non-integer argument has no effect (unlike Internet Explorer, which supports string URLs as the argument).
@DomName('History.go')
@DocsEditable
void go(int distance) native;
dynamic noSuchMethod(Invocation invocation) #
noSuchMethod is invoked when users invoke a non-existant method
on an object. The name of the method and the arguments of the
invocation are passed to noSuchMethod in an Invocation.
If noSuchMethod returns a value, that value becomes the result of
the original invocation.
The default behavior of noSuchMethod is to throw a
noSuchMethodError.
dynamic noSuchMethod(Invocation invocation) {
throw new NoSuchMethodError(
this,
_symbolToString(invocation.memberName),
invocation.positionalArguments,
_symbolMapToStringMap(invocation.namedArguments));
}
void pushState(Object data, String title, [String url]) #
Pushes the given data onto the session history stack with the specified title and, if provided, URL. The data is treated as opaque by the DOM; you may specify any JavaScript object that can be serialized. Note that Firefox currently ignores the title parameter; for more information, see manipulating the browser history.
@DomName('History.pushState')
@DocsEditable
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.FIREFOX)
@SupportedBrowser(SupportedBrowser.IE, '10')
@SupportedBrowser(SupportedBrowser.SAFARI)
void pushState(Object data, String title, [String url]) native;
void replaceState(Object data, String title, [String url]) #
Updates the most recent entry on the history stack to have the specified data, title, and, if provided, URL. The data is treated as opaque by the DOM; you may specify any JavaScript object that can be serialized. Note that Firefox currently ignores the title parameter; for more information, see manipulating the browser history.
@DomName('History.replaceState')
@DocsEditable
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.FIREFOX)
@SupportedBrowser(SupportedBrowser.IE, '10')
@SupportedBrowser(SupportedBrowser.SAFARI)
void replaceState(Object data, String title, [String url]) native;
This page includes content from the
Mozilla Foundation that is graciously
licensed under a
Creative Commons: Attribution-Sharealike license.
Mozilla has no other association with Dart or dartlang.org. We
encourage you to improve the web by
contributing to
The Mozilla Developer Network.