Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
spham #1
How to get javascript to read new value of sessionvariable.
- From page 1, I initialize session variable A to 0
- On page 2, I use javascript to launch a popup windown if session variable A
= 0. After that, I change session variable A to 1. My intention is to not
show the popup again when user navigates back to page 2.
- However, when user submits the page to to go page 3 and uses the browser
back button to navigate back to page 2, the popup window is brought up again.
Is there a way to force the javascript to source the new value of the session
variable so that the popup doesn't come up again? Or may be there a different
way to handle this? Please advice. Thanks.
spham Guest
-
Include javascript in a javascript file
Hello, Is there a way to include a javascript file from WITHIN a javascript file? Something similar as in the "#include" directive in C++? ... -
output text in control location; calling control javascript from page javascript
Hi; If you don't know, I'm just learning javascript and aspnet, but I have a pretty good grounding in windows programming. I'm trying to build a... -
need javascript staff (anyone who knows javascript peroid) (READ)
hey its me ultimategamerx and im back in some clothes lol i need some people who know java script i need help please reply if ya know some -
File system get auto change from read-write to read-oly
I have a very strange file system with OS Redhat 7.2 The file system is read-write, but some how it randomly changes to read-only at any time.... -
Read & Read/Write Groups
I am trying to achieve a solution to a (hopefully) simple scenario. I have a Solaris 9 server that is going to be used for sharing files. I... -
GGRam #2
Re: How to get javascript to read new value of sessionvariable.
Spham,
As I understand it when the user clicks the back button, the page is loaded
from their browser cache. Since no server side processing is involved the
session varaible remains as a value of 0. The best workaround would be have
your page 2 reload itself immediately after the pop-up is displayed (using
javascript and after the session variable has been changed). Then when the user
moves on to page 3, the back button will reload the second display of page 2,
where the session variable has already been change to 1.
The alternative is to try and disable the use of the back button (opening
the browser using javascript with toolbar and mneubar set to no).
GGRam Guest
-
spham #3
Re: How to get javascript to read new value of sessionvariable.
When I reload the page, I get the message that says "The page cannot be
refreshed without resending the information. Click Retry to send the
informaiton again, or click Cancel to return to the page that you were trying
to view." Is there a way to avoid this confirmation window?
spham Guest
-
jeby #4
Re: How to get javascript to read new value of sessionvariable.
I dont know if this will work, but what if you told the browser not to cache
the page by using something along the line of....
<cfheader name="Pragma" value="no-cache">
or
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
This way the browser you go back to the server for the document and would
receive a new copy where your session var is now 1....
Just an idea...good luck!
jeby Guest
-
roadsend #5
Re: How to get javascript to read new value of sessionvariable.
How did you use Javascript to change the coldfusion session variable that you describe?
thanks,
matt
roadsend Guest
-
eastinq #6
Re: How to get javascript to read new value of sessionvariable.
You can also set a cookie on the client side to control the popup when the user
clicks on the back button.
Here is an example using your scenario:
<!--- page1.cfm --->
<html>
<body onLoad="document.cookie='A=0'">
PAGE 1<br>
<a href="page2.cfm">Goto Page 2</a><br>
</body>
</html>
<!--- page2.cfm --->
<html>
<head>
<script language='JavaScript'>
function popup()
{
if ( document.cookie == "A=0" )
{
document.cookie = "A=1";
window.alert('hello');
}
}
</script>
</head>
<body onLoad="popup()">
PAGE 2<br>
<a href="page3.cfm">Goto Page 3</a><br>
</body>
</html>
<!--- page3.cfm --->
<html>
<body>
PAGE 3<br>
<a href="page1.cfm">Go back to Page 1</a>
</body>
</html>
eastinq Guest



Reply With Quote

