Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Execute javascript before setting cookie headers

by cfreak (Chaplain)
on Sep 28, 2005 at 00:19 UTC ( [id://495597]=note: print w/replies, xml ) Need Help??


in reply to Execute javascript before setting cookie headers

As it was pointed out already, you can't save an image in a cookie. You can preload images without displaying them and they will be cached. There are countless examples on the web, I trust you can use Google ;-)

However you can use the onSubmit handler in the browser to execute some javascript before your form submits. Remember though: the user can turn it off, or otherwise muck with it as they see fit so don't rely on it to do any validation or set some needed parameter in your server side code

If you're trying to do something with the server, then have the Javascript do something and then have the server continue .... well you can't do that, and I'm not really sure why you would want to. Javascript can set cookies itself, google for that one as well.

Also as a general rule you should use CGI; which will handle cookies for you easily and safely.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://495597]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-04-19 14:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found