Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 5 of 5
  1. #1
    Junior Member
    Join Date
    Aug 2003
    Posts
    3
    Member #
    2573
    is it possible for a page to detect if someone has got to it by hitting the back button and if so to automatically redirect to a different url

  2.  

  3. #2
    Senior Member skrlin's Avatar
    Join Date
    Apr 2003
    Location
    Illinois
    Posts
    562
    Member #
    1063
    There's no way to tell explicitly if the back button was used.

    You could create somewhat of a work-around by using the document.referrer property, for instance at the top of the page:

    Code:
    <script type="text/javascript">
     var page = document.referrer;
     noNoPage = 'http://www.yourdomain.com/otherPage.html' // page you don't want the back button pressed on
     var redirPage = 'http://www.yourdomain.com/redirPage.html'
     if (page == noNoPage) { 
      location.replace(redirPage);
     }
    </script>
    - Brian

  4. #3
    Junior Member
    Join Date
    Aug 2003
    Posts
    3
    Member #
    2573
    thanks for that, works well, im quite a novice in javascript, mainly just do basic html.

    could it be done this way

    If javascript "BrowserForwardPage" is "NoNoPage" then BrowserGoBack??

  5. #4
    Senior Member skrlin's Avatar
    Join Date
    Apr 2003
    Location
    Illinois
    Posts
    562
    Member #
    1063
    I'm confused by your wording...
    What would you be trying to accomplish with that ?
    - Brian

  6. #5
    Junior Member
    Join Date
    Aug 2003
    Posts
    3
    Member #
    2573
    sorry for confusion,

    when the user is on the NoNopage and hits "Back", the page held under the browser "forward" button would be the NoNoPage and so if the script went "Back 1" from this page, the user would be back at the original page.

    trying it this way to save hardcoding script for each individual page.

    can this be done?. im not sure if browser lets script read whats in forward link.

    thanks


Remove Ads

Posting Permissions

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

Search tags for this page

browser back button referrer
,
detect back button click javascript
,
detect if back button has been used
,
detect if back button was used
,

detecting back button click in javascript

,
how to detect back button has been used
,
html detect when back has been used
,
javascript back button click
,

javascript detect if back button was used

,
javascript read if back
Click on a term to search for related topics.
All times are GMT -6. The time now is 10:48 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com