Hmmmm...sounds like a good suggestion, but I'm confused. At which point should I be ESCAPING and UNESCAPING the string?
Should I escape it before storing it in document.cookie, as below?
document.cookie = escape(test);
Then at which point do I unescape it? When I assign the
window.location...
...is what the above chosen value looks like when passed to the server:
/b2b-playground/b2b/init.do;jsessionid=ID4001DB0.9722336212
620123End;sap2ee_*=4001?shopId=COMPANY&null
Some data is added to the above string, using Javascript, to make a cookie string:
var expiration = new...
Can I have more than one argument serve as the delimiter in the SPLIT method? Whenever I read about SPLIT, I read about passing one delimiter to it. However, I need to split a string on encountering both an "=" sign and a ";". Is there a way to do it?
Thanks
How would I go about resolving this situation then? From what you're saying it seems that setting cookies with Javascript won't work, because JSP does what it wants. I know nothing about JSP, and I'm merely trying to add my HTML and Javascript code to a kind of template used here at the...
...present, how is this possible? Furthermore, the statement "document.cookie" returns the following value even when no cookie is present:
"sapj2ee_*=4001;JSESSIONID=ID4001DB0.02315627049120228End".
What is going on?
THe full code is displayed below. The javascript and accompanying body have...
I've noticed something strange...to make sure that my javascript wasn't failing because of my html references or some file browsing issue, I decided to use the addresses of famous search engines as the values to assign to the variable URL. What's strange is that the cookie file stored on my...
Might it have something to do with IIS??? The following is the message I get when the first redirection is attempted:
The page cannot be displayed
The page you are looking for cannot be displayed because the page address is incorrect.
_____________________________
HTTP 405 - Resource not...
I did as you suggested, and the results, ironically enough, are exactly the same. Ie, redirection fails when you click on GO and the cookie is set, but it works when you open up the page once the cookie has been created. Strange!!!!!
Okay, I feel I'm on the final lap.
Chessbot, the capitalization suggestion solved the biggest problem, ie the function not running.
I've made a few modifications to the code, based on all of your suggestions. I have added some alerts to also debug better. There is one last problem I'm facing...
Wow, I'm baffled. cLFlava, I made the change you suggested and it fixed that part of the code. The problem is that the cookie is still not being written. In fact, I added an alert box in the third line of the SetCookie function just to see whether that function was being run at all:
function...
That solves part of the problem. However, the cookie setting-page never loads, because I am being redirected as soon as the page loads. There is a flaw in my code logic, and I think it is because I am not properly detecting the absence of a cookie. In my original code (posted above), I have...
I have a simple webpage to test the functionality of a cookie. THe user chooses an animal from the menu, and if the checkbox is selected, the cookie is written and the document loads another page. After the cookie is set, a ReadCookie function is called to redirect the user.
When I click on...
...Javascript code:
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var expDays = 180;
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr =...
my $cookie_out" is above the if statement, as you posted in your code...but the cookie isn't being created. Here is the code. Thanks
use CGI qw/:standard/;
my $query = new CGI;
my $cookie_in = $query->cookie('region');
if ($cookie_in) {
if ($cookie_in eq "americas") {
print...
It's interesting. Now redirection works when you check the "Remember my location" box and click GO, but a cookie is never set! Any ideas as to why?
Thanks
The only difference that did is that I'm now getting a "Status: 302 Moved Location: http://www.somelocation.com"
as opposed to "Location: http://www.somelocation.com".
What else can I try?
Thanks
I have a page with a drop-down menu to select a region, and a check mark to allow the region to be remembered in future sessions.
When the user selects a region and clicks on "GO", the redirection works. If the user checks the "Remember my selection" box, a cookie is set, but redirection...
When the user types in www.somesite.com, they are prompted to select a region (europe, asia, americas, etc). This information is stored in a cookie. Next time they type in www.somesite.com, I want the server to read the cookie and automatically send them the page that is applicable to their...
I have a cookie with a value that will control what page is loaded when the user types www.somesite.com.
Apart from:
PRINT "Location: $url \n\n"; and the
and
print $query->redirect($url),
is there any other way to load a page based on cookie value?
Thanks
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.