Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing value one web page to another without using form?

Status
Not open for further replies.

shaunacg

Programmer
Aug 1, 2003
71
GB
I am trying to unload my web page whenever I move to another page in my site so that it will reload if I ever come back to it say by using the back button. Can I do this? I want to do this because my Session variable is updated to a new value in my ASP when the page loads.
I tried what is below with no luck:

<SCRIPT language=&quot;VBScript&quot;>
Function document_onBlur()
document.close()
End Function
</SCRIPT>

I heard something about maybe using a querystring but don't really know what to do with it.
 
How about the use of the <meta> tags. I am sorry but I am not terribly familiar with them myself, but a little research at


got me started on that line of thought. Would be interested to know if that helps.

--------------------------------------------------------------------------------------------------------------------------
Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so.
--Douglas Adams
 
if you pass variables in the url
(i.e.: then Request.QueryString(&quot;var1&quot;) is 7
Request.QueryString(&quot;var2&quot;) is 13
Request.QueryString(&quot;var3&quot;) is &quot;Good&quot;

If you want to be able to do both, I suggest the function below as a generally good thing to have in your pages.

Function GetVar(strng)
If Not Request.Form(strng) = &quot;&quot; Then
GetVar = Request.Form(strng)
Else
GetVar = Request.QueryString(strng)
End If
End Function
 
Not sure if I completely understand the question, but it seems like you are trying to reload the pasge to its original state when the back button is used. If this is correct, you could just reset your session to the original value at the beginning of any page that you may navigate to within your site. This way when you get back to the page in question, your session variable is back to the value you need.
 
you could also use the following javascript function to detect whether the back button was pressed (under the assumption that only the back button doesn't request a new page from the server) With that you can do whatever you want.

Code:
var x=&quot;1&quot;;
var isBack;
function handleBackButton(){
   isBack = (x != document._mine._a1.value);
   document._mine._a1.value=2;
   document._mine._a1.defaultValue=2;
}

function isBackButtonUsed(){
 return isBack;
if (x >= 1)
	{alert(&quot;he he&quot;);}
}

then this html:

<BODY ONLOAD=&quot;handleBackButton(); &quot;>
<FORM NAME=&quot;_mine&quot;>
<INPUT NAME=&quot;_a1&quot; VALUE=&quot;1&quot; STYLE=&quot;visibility:hidden&quot;><input type=button value=&quot;is back button&quot; onclick=&quot;(isBackButtonUsed())?
alert('Back button was used'):alert('Page was loaded normally')&quot;>
</FORM>
 
Hi thanks for all of your advice. I think I can actually combine some of your responses for the best result. And I'll do some research about Meta for future use.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top