how do i disable the BACK button of IE.can it be done using session.if so can anyone please explain me how it works and give me a bit of information about this session thing as i have no idea about it and when i searched the web it left me confused.its urgent

how do i disable the BACK button of IE.can it be done using session.if so can anyone please explain me how it works and give me a bit of information about this session thing as i have no idea about it and when i searched the web it left me confused.its urgent

Hi,

Same thread is posted here in this forum before also. some imp lines from that post..
You cannot disable the back button. It is just not possible.

Post One--
You can hide the bars with code, but by right clicking, the "back" link is still there.

You can disable the right-click but the backspace still sends you back a page.

You can disable the backspace event, and you thought of everything.

Except when the user goes to the internet explorer File -> View -> Toolbars...

And then you have to start all over again. Like I said, it's just not possible

Post Two --

<script type="text/javascript" language="javascript">
javascript:window.history.forward(1);
</script>

if you need no navigation in X page you will add this code in previous of X page.

Now About session--
Generally when we want to pass values from one page to another page that time we use sessions. We can also use Query string also. But Problem using Query string is our data is not secured. The address bar of browser shows the passing value. One more way is using hidden fields.
Talking about sessions , here we can safely pass values.

How to create session variable-----
Simply as follows...
session ("MyVariableName") = Value to pass
Accessing value of session variable---
Variable = Val(Session("MyVariableName"))
------------------------------------------
Now here some trick you need to use to solve your problem.
Here i am considering that you are using a LogIn in your project for example.
Create a Session Variable on LogIn page after LogIn success.
After that You can check the session variable value on each page. If it is empty then you can restrict the user for login. Session variable maintains there state during whole project.

One more clue i can give here is as .. You can clear a session variable value as per your need as,

session("MySessionVariable") = 0

Please refer more guidance and proper sites for this. As i am not a perfect one i have provided a solution as per my current knowledge.

Best Luck.... :)

There might be a way around it, however it is untested.

However, it requires scripting for every single page:

Let's say you create something on one page and it redirects you to the next to view the results. You probably don't want them hitting the back page and clicking refresh or something... soo, you would need something like this... and what this does is searches the previous referrer:

<% If Not InStr(1, Request.ServerVariables("HTTP_REFERRER"), "/FileNameThatYouWereJustAt.aspx") > 0 Then %>
<script type="text/javascript" language="javascript">
javascript:window.history.forward(1);
</script>
<% end if %>

Or register the script on page load.

where do i write the above script

drop the "javascript:" and add the script anywhere. Can't believe I through that in there.. :\

what you could also do, try this one as well, and add it in the Head Tag to be executed on page load:

<script type="text/javascript">
if(document.history.go(1))
{
	window.history.forward(1);
}
</script>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.