SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Addict
    Join Date
    Apr 2000
    Location
    Winchester, Hampshire, England
    Posts
    240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Does anyone know of a forward and back button script that will work well in IE and Netscape?

    TIA

    Peter
    Thread Closed - Before and After.
    www.Gods101.co.uk - Affordable Quality.
    www.scepticism-inc.com - All extremists should be taken out and shot!

  2. #2
    Irritability Defined
    Join Date
    Jul 2000
    Location
    80,000 feet below the surface
    Posts
    1,442
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can have a look at this :

    http://www.kevjudge.co.uk/fwdback.htm

    or have look at the useful resource base at http://developer.irt.org/script/history.htm and hopefully find your answer there.

  3. #3
    will code HTML for food Michel V's Avatar
    Join Date
    Sep 2000
    Location
    Corsica
    Posts
    552
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I thought it was just a matter of basic Javascript, like "javascript:history(-1)" (or something approaching, i don't remember).
    But then i must be wrong.
    This basic javascript command works well everywhere.
    [blogger: zengun] [blogware contributor: wordpress]

  4. #4
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Peter & Shin Ma,

    history.go(-1) returns to the previous page
    history.go(1) goes to the next page
    history.go(0) refreshes/reloads the current page (I use it a lot when working with dynamic selection lists and netscape)

    note for the first two to work there need be previous and next pages. you can insert any number within the parentheses. For example, history.go(-2) will go back 2 pages from the current one.

    Placing the history.go(0) in an onLoad event handler will cause the page to fall into a loop. So, if you ever use it, do so only within a function that does not get called within the loading process.

    Hope this clarifies some.
    Vinny
    Where the World Once Stood
    the blades of grass
    cut me still

  5. #5
    SitePoint Zealot
    Join Date
    Jun 2000
    Posts
    165
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello there,

    Continuing the theme of back and forward buttons:

    Does someone know how to disable the back button so that user's cannot press it, please?

    Regards,

    Ed

  6. #6
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Strictly speaking, you can't. Browser's don't let you mess with the page history for security reasons.

    Your only alternative would be to pop up a new browser window (using the window.open() property to prevent history from being copied to the new window).

    Using the location.replace() method, you can create links that replace the current page in the browser history, rather than adding a new entry to the history. If you made all the links on your site with this technique, then you could prevent users from navigating backwards within your site.
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference

  7. #7
    SitePoint Zealot
    Join Date
    Jun 2000
    Posts
    165
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks kevin!!!

  8. #8
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    You can also try putting a var in each page (eg, pageNum or DocName) and then in the body tag use the onload event handler to call a function that checks the value of the opener's variable. If it's higher than the one found in the current page, href the user to the appropriate page.

    Vinny
    Where the World Once Stood
    the blades of grass
    cut me still

  9. #9
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Check out http://www.devshed.com/Talk/Forums/F...ML/000715.html for a good IE method also.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •