mboehler3 Posted October 20, 2012 Share Posted October 20, 2012 I'm trying to set a cookie for a user *only* when they click a certain link. My code is in ASP.The code I'm using looks like this: <a href="/backend/" rel="external" id="footlink" onclick="<% Response.Cookies("mobile") = "Full" Response.Cookies ("mobile").Expires = DATE + 30%>"> Full Site </a> But it's not working, it's setting the cookie even though the link isn't clicked. What can I do to fix this? Link to comment Share on other sites More sharing options...
dsonesuk Posted October 20, 2012 Share Posted October 20, 2012 As soon as that asp code is reached, it sets the cookie, all server code is run on loading on page, use javscript to set cookie on clicking of link. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now