2 Replies - 627 Views - Last Post: 09 April 2011 - 11:09 AM

#1 aaraf  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 31-March 11

disable going backward

Posted 09 April 2011 - 07:24 AM

hi
I knew very little about javascript and I didn't used it before a lot but now I Have a problem that: I want the pages in my website to go only forward and disable going backward
I mean the user can not go back to the previews page in some pages
and I've been told that i can do that using javascript but I don't know how or using what .pleace help :helpsmilie:

Is This A Good Question/Topic? 0
  • +

Replies To: disable going backward

#2 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3710
  • View blog
  • Posts: 5,958
  • Joined: 08-June 10

Re: disable going backward

Posted 09 April 2011 - 08:23 AM

Hey.

Can I ask why you want this? Generally speaking, it's not a good idea to restrict your users like that.The ability to go backwards is a browser feature that most of us kind of like having around and won't appreciate you disabling it. -- That said, you may well have an excellent reason. But if there is a better way, other than disabling basic feature like this, I would recommend that instead.


Now, there really isn't any way to disable the user's ability to go back. It's a browser feature your scripts can not -- and should not -- control. However, you can kind of "trap" the user by controlling where the user goes when he goes back.

That is, if you have a "index.html" page that the users goes to initially, you could have Javascript immediately redirect you to "index.html?ready" (or something similar that allows Javascript to recognize the the redirect has taken place). Then when you user tries to go back, he'll just end up back at "index.html" and gets sent right back to "index.html?ready". -- It's got a huge cavity though. If the browser allows users to go back multiple pages in one go, they can just bypass it. Not much you can do about things like that.
Was This Post Helpful? 1
  • +
  • -

#3 aaraf  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 31-March 11

Re: disable going backward

Posted 09 April 2011 - 11:09 AM

View PostAtli, on 09 April 2011 - 08:23 AM, said:

if you have a "index.html" page that the users goes to initially, you could have Javascript immediately redirect you to "index.html?ready" (or something similar that allows Javascript to recognize the the redirect has taken place). Then when you user tries to go back, he'll just end up back at "index.html" and gets sent right back to "index.html?ready". -- It's got a huge cavity though. If the browser allows users to go back multiple pages in one go, they can just bypass it. Not much you can do about things like that.

how can I do that?I wish you give me any basic information about that or a link to a tutorial that learn me how to do that
thank you : :flowers:
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1