Home > Articles > Open Source > Ajax & JavaScript

  • Print
  • + Share This
This chapter is from the book


  1. I can use history and document instead of window.history and window.document. Can I leave out the window object in other cases?

  1. Yes. For example, you can use alert instead of window.alert to display a message. The window object contains the current script, so it's treated as a default object. However, be warned that you shouldn't omit the window object's name when you're using frames, layers, or multiple windows, or in an event handler.

  1. I used the document.lastModified method to display a modification date for my page, but it displays a date in 1970, or a date that I know is incorrect. What's wrong?

  1. This function depends on the server sending the last modified date of the document to the browser. Some Web servers don't do this properly, or require specific file attributes in order for this to work.

  1. Can I change history entries, or prevent the user from using the Back and Forward buttons?

  1. You can't change the history entries. You can't prevent the use of the Back and Forward buttons, but you can use the location.replace() method to load a series of pages that don't appear in the history. However, the Back button will still take the user to the page they visited before yours.

  • + Share This
  • 🔖 Save To Your Account