Your SlideShare is downloading. ×
0
History object
History object
History object
History object
History object
History object
History object
History object
History object
History object
History object
History object
History object
History object
History object
History object
History object
History object
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

History object

988

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
988
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. www.ustudy.in
  • 2. History objects are predefined objects which contains the complete information about the links and URL’s visited during the session. www.ustudy.in
  • 3. • length: • The length property of the history object returns the number of elements in the history list. • General syntax of length property of history Object: – history.length www.ustudy.in
  • 4. <html> <body> <script type="text/javascript"> var ex = history.length; document.write("The number of pages visited before this page is" +ex+ " pages!!!.") </script> </body> </html> www.ustudy.in
  • 5. • The output of the above program is • The number of pages visited before this page is 5 pages!!! • This means that there are 5 entries in the history list and denotes the number of pages visited before visiting the current page. www.ustudy.in
  • 6. • This property contains the complete URL of the current History entry. • General syntax of current property of history Object: • history.current www.ustudy.in
  • 7. • The next property of history object contains the complete URL of the next element in the History list. This functionality or the URL visited is the same as pressing the forward button or menu. • General syntax of next property of history Object: • history.next www.ustudy.in
  • 8. • The previous property of history object contains the complete URL of the previous element in the History list. This functionality or the URL visited is the same as pressing the back button or menu. • General syntax of previous property of history Object: • history.previous www.ustudy.in
  • 9. • back(): • There may be scenarios where the programmer wishes to load the previous URL present in the history list. In this case, the programmer can make use of the back() method of the history object. The back() method of the history object takes the user to the previous page. The functionality results in the same as pressing the back button of the browser. • General syntax of back method of history Object: • history.back() www.ustudy.in
  • 10. www.ustudy.in <html> <head> <script type="text/javascript"> function funback() { window.history.back() } </script> </head> <body> <input type="button" value="Press the Button to go to Previous Page!!!" onclick="funback()" /> </body> </html>
  • 11. • The output of the above program is a button with message as • Press the Button to go to Previous Page!!! • When this button is pressed, the control is navigated to the previous page. www.ustudy.in
  • 12. • The forward() method of the history object loads the next URL in the History list. The functionality results are the same as pressing the forward button of the browser. • General syntax of forward method of history Object: • history.forward() www.ustudy.in
  • 13. www.ustudy.in <html> <head> <script type="text/javascript"> function funfor() { window.history.forward() } </script> </head> <body> <input type="button" value="Press the Button to go to Next Page!!!" onclick="funfor()" /> </body> </html>
  • 14. • The output of the above program is a button with message as • Press the Button to go to Next Page!!! • When this button is pressed, the control is navigated to next page (to the next URL) in the history list. www.ustudy.in
  • 15. • If the programmer wishes to load a specified URL from the History list, then the go method of history object can be used. • General syntax of go method of history Object: • history.go(number) or history.go(URL) • The back method seen above is the same as history.go(-1) in terms of go method of history object. The forward method seen above is the same as history.go(1) www.ustudy.in
  • 16. www.ustudy.in <html> <head> <script type="text/javascript"> function funfor() { window.history.go(1) } </script> </head> <body> <input type="button" value="Press the Button to go to Next Page!!!" onclick="funfor()" /> </body> </html> The output of the above program loads the next page in the history list.
  • 17. • http://www.w3schools.com/jsref/obj_history.as p • http://www.exforsys.com/tutorials/javascript/ja vascript-history-object-properties-and- methods.html www.ustudy.in
  • 18. www.ustudy.in

×