Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Client variable wiped after opening a new window

New Here ,
Jul 08, 2022 Jul 08, 2022

My application used a Java function to open a new window. Code worked fine when it was in Coldfusion11 server but when it's Coldfusion 2021, all the client variables are deleted when the new page opened. Here is the Java part :

PhucMinh251787279b7r_0-1657309334697.png

I've compared all the setting in the coldfusion admin page of both server.

Is there any hidden setting anywhere or some change between coldfusion version that can keep client variables between pages? Can you suggest any reasons why client variables would just disappear?

402
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jul 08, 2022 Jul 08, 2022

Java and javascript are very different animals. You appear to be talking about the latter, not the former.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 08, 2022 Jul 08, 2022

I doubt your client variables are disappearing, though it will seem that way to you. Instead, I'd bet that the cookies cf uses for them (cfid and cftoken) are somehow not being sent in the request. Add a cfdump var="#cgi#" and focus on the http_cookie key in that struct (note I'm NOT having you dump the cookie scope).

 

What does that show between requests where you feel client variables are lost?

 

And is the first page requested via http or https? And the second? If the first is a form, is the form action using http or https? If the first has a link to the second, is that http or https?

 

There is a secure option on the cf admin memory variables page. Is it checked or not? 


/Charlie (troubleshooter, carehart. org)
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 08, 2022 Jul 08, 2022

Client variables are "stateless", or they're supposed to be. CF uses cookies or URL parameters, and in theory if you open multiple tabs or windows in the same browser, CF should see that you're the same user and give you access to the same Client scope.

 

That doesn't seem to be working for you. So, my guess is that those cookies or URL parameters are being passed correctly with CF 11 and not being passed the same way with CF 2021. There are a few reasons that aren't specifically related to the version of CF you're using, but have to do with how CF and your web server are connected. So, the first thing I'd do is dump your CGI scope with CFDUMP and see what's different with cookies and URL parameters in there.

 

Dave Watts, Eidolon LLC 

Dave Watts, Eidolon LLC
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 09, 2022 Jul 09, 2022

There can be any number of reasons why client variables are no longer available. So I shall give you a working example that includes many factors.

 

The hope is that it will provide you with a net with which you can close in on the relevant factor.

 

The steps:

(1)

In the ColdFusion Administrator, go to the page Server Settings > Client Variables.

Select the option "Cookie" for client storage, and press the button "Apply".

 

(2)

Still in the ColdFusion Administrator, go to the page Debugging & Logging > Debug Output Settings.

Tick as many debug-output checkboxes as possible. In particular, all the checkboxes in the category "Variables", and press the button "Submit Changes".

BKBK_0-1657368937291.png

 

(3)

Create a directory named "test" under the web root (for testing, naturally).

Create the following 3 files and place them in the test directory.

 

<!--- Application.cfc --->
<cfcomponent>
    <cfscript>
        this.name = "TestApp1";
        this.applicationTimeout = "#createTimespan(0,1,0,0)#";
        this.clientManagement = "true";
        this.clientStorage = "cookie";

        this.loginStorage = "session";
        this.sessionManagement = "true";
        this.sessionTimeout = "#createTimeSpan(0,0,20,0)#";
        this.setClientCookies = "true";
     	
    </cfscript>
    
	<cffunction name="onApplicationStart" returntype="boolean">
		
	
	    <cfreturn true>
	 </cffunction>

</cfcomponent>

 

 

<!--- testPage1.cfm --->
<cfset adressession="testPage2.cfm">

<cfoutput>
	<script type="text/javascript" language="javascript">
	function js_nouw_fen()
	{
		logfenetre02=window.open('about:blank', 'fen02', 'titlebar=no, left=100px, top=175px, width=800px, height=400px');
		logfenetre02.location.href="#adressession#";
		return false;
	}
	</script>	
</cfoutput>

<!--- 
When the page loads, the Javascript function runs, 
opening testPage2.cfm in a new browser window
--->
<body onload="js_nouw_fen()"></body>

 

 

<!--- testPage2.cfm --->
<!---
Dump of the session scope and the client scope
--->
<cfdump var="#session#" label="Session scope">
<p>
	<cfdump var="#client#" label="Client scope">
</p>

 

(4) 

Launch testPage1.cfm in the browser. A new window should open, launching testPage2.cfm in turn.

 

Inspect the contents of the new window. You should see dumps of the session and client scopes. You should also see debugging information pertaining to client variables, such as CGI, session and cookie.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 11, 2022 Jul 11, 2022
LATEST

Here is what show in the second window. Is the different between cfid/cftoken in session and client scope what caused my problem ? I used "inspect" from browser and coockies from both windows show the session cfid (1952)

ShurimaPriest_0-1657575582100.png

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources