public class History extends Object implements Serializable
Constructor and Description |
---|
History(WebWindow window)
Creates a new navigation history for the specified window.
|
Modifier and Type | Method and Description |
---|---|
protected org.htmlunit.History.HistoryEntry |
addPage(Page page)
Adds a new page to the navigation history.
|
History |
back()
Goes back one step in the navigation history, if possible.
|
History |
forward()
Goes forward one step in the navigation history, if possible.
|
Object |
getCurrentState()
Returns current state object.
|
int |
getIndex()
Returns the current (zero-based) index within the navigation history.
|
int |
getLength()
Returns the length of the navigation history.
|
URL |
getUrl(int index)
Returns the URL at the specified index in the navigation history, or
null if the index is not valid. |
History |
go(int relativeIndex)
Goes forward or backwards in the navigation history, according to whether the specified relative index
is positive or negative.
|
void |
pushState(Object state,
URL url)
Allows to change history state and url if provided.
|
void |
removeCurrent()
Removes the current URL from the history.
|
void |
replaceState(Object state,
URL url)
Allows to change history state and url if provided.
|
String |
toString() |
public History(WebWindow window)
window
- the window which owns the new navigation historypublic int getLength()
public int getIndex()
public URL getUrl(int index)
null
if the index is not valid.index
- the index of the URL to be returnednull
if the index is not validpublic History back() throws IOException
IOException
- in case of errorpublic History forward() throws IOException
IOException
- in case of errorpublic History go(int relativeIndex) throws IOException
0
, this method reloads the current page.relativeIndex
- the index to move to, relative to the current indexIOException
- in case of errorpublic void removeCurrent()
protected org.htmlunit.History.HistoryEntry addPage(Page page)
page
- the page to add to the navigation historypublic void replaceState(Object state, URL url)
state
- the new state to useurl
- the new url to usepublic void pushState(Object state, URL url)
state
- the new state to useurl
- the new url to usepublic Object getCurrentState()
Copyright © 2002–2024 Gargoyle Software Inc.. All rights reserved.