The SVG Window.history property returns a reference to the History object.
Syntax:
var e = window.history
Return value: This property returns a reference to the History object.
Example 1: In this example we will use onclick event.
html
<!DOCTYPE html>
< html >
< body >
< center >
< h1 >GeeksforGeeks</ h1 >
< button onclick="get()">
Get History
</ button >
< br >< br >
< div id="g"></ div >
< svg viewBox="0 0 1000 1000"
< script type="text/javascript">
function get() {
console.log(window.history);
}
</ script >
</ svg >
</ center >
</ body >
</ html >
|
Output:

Example 2: In this example we will use onmouseover event.
html
<!DOCTYPE html>
< html >
< body >
< center >
< h1 >GeeksforGeeks</ h1 >
< button onmouseover="get()">
Get History
</ button >
< br >< br >
< div id="g"></ div >
< svg viewBox="0 0 1000 1000"
< script type="text/javascript">
function get() {
console.log(window.history);
}
</ script >
</ svg >
</ center >
</ body >
</ html >
|
Output:

Supported Browsers:
- Google Chrome 1 and above
- Edge 12 and above
- Firefox 1 and above
- Safari 1 and above
- Opera 3 and above
- Internet Explorer 4 and above