function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
GaliaGalia 

Passing Cookie between Visualforce Pages

I created 2 different visualforce pages, one in which you set a cookie and another that is using the cookie (both using JavaScript).

When testing the 2 pages, opening using /apex/page, all works correctly.

When placing the login page in the sidebar and the other page in the case layout, the cookie doesn't seem to pass from the sidebar page to the case page.

 

This is the page in which I set the cookie:

 

<apex:page standardStylesheets="false" sidebar="false" showHeader="false">

<apex:includeScript value="{!$Resource.LPAloginFunctions}"/>

<apex:form >

User: <input name="lpaUser" id="lpaUser" type="text" value=""></input><br/>

Pass: <input name="lpaPass" id="lpaPass" type="password" value=""></input>

<p>

<input type="button" value="Log in" id="signIn" name="signIn" onclick = "submitLoginCredentials()"></input>

<input type="button" value="Delete Cookie" id="delCookie" name="delCookie" onclick = "deleteLpaCookies()"></input><br/>

</p>               

<script type="text/javascript">        

var mydomain=window.location.hostname;       

document.write(mydomain);              

var cookieValue = getCookie('lpaUser') ;        

document.write(cookieValue);          

if(cookieValue  == '' || cookieValue.toString() == "undefined" ){              

document.getElementById("lpaUser").value = "ENTER USER NAME";        

}          

else{              

document.getElementById("lpaUser").value = getCookie('lpaUser') ;              

document.getElementById("lpaPass").value = getCookie('lpaPass');          

}

</script>    

</apex:form>    

</apex:page>

 

This is part of the page in which I get the cookie:

 

<script type="text/javascript">         

var cookieValue = getCookie('lpaUser') ;          

if(cookieValue  == '' || cookieValue.toString() == "undefined" ){              

document.getElementById("lpaUser").value = "ENTER USER NAME";          

}          

else{              

document.getElementById("lpaUser").value = getCookie('lpaUser') ;              

document.getElementById("lpaPass").value = getCookie('lpaPass');          

}

</script>

 

How can I use a cookie set in the sidebar page, in the case layout page?

 

Thanks!