How can I pass a URL string from one page to another?
-
I'm trying to pass a parameter to all consecutive URLs thereafter in the same domain. The entered URL will be something like http://www.mailninja.co.uk/?source=doug but onclick the URL becomes http://www.mailninja.co.uk/signup rather thanhttp://www.mailninja.co.uk/signup?source=doug Any ideas how to achieve this?
-
Answer:
That's the typical use case for cookies. When getting source=doug in the URL, you set a cookie called "source" to "dough". That information will then be sent back to your site with every request, without being visible in the URL. Unless of course the browser blocks the cookie, but that is rare these days. Alternatively, you can use URL rewriting - that is, when you see source=doug in the URL, make sure all URLs on the page are generated to also include source=doug (or you use search&replace on the finished page - that is messy, but allows for the page content be cached or static).
Daniel Kinzler at Quora Visit the source
Other answers
Hi I need more detail. Sounds to me like you want to store the source in the session or cookie. You do not mention if this is client or server side, either or both. Do you perhaps mean Single Signon? http://stackoverflow.com/questions/1043111/transparent-user-session-over-several-sites-single-sign-on-single-sign-off/1057199#1057199
Michel Plungjan
Looks like you are missing the session data per user. 1. Given a user has a cookie for your domain and you have corresponding session data on the server. 2. When you receive the request "http://www.mailninja.co.uk/?source=doug" you will receive it with a cookie in HTTP headers. Then you might be doing some processing and redirecting the user to " http://www.mailninja.co.uk/signup". This looks like a login page. Store the state information about the session that request with this cookie after login has to go the original one. 3. Now when you receive the login credentials along with the cookie. You verify the login and redirect the user to the one you want. You can do that using Javascript or through a <meta> tag. You have missed out on many critical information like which framework you are using, what kind of login you are expecting etc. Tips: 1. Install Wireshark and monitor the HTTP requests coming and going through this website, they will give you enough hint. 2. On the webserver / application serverĀ e.g. Glassfish, Tomcat, Django etc. enable logging. 3. Ask on StackOverflow.
Ravi Arora
Related Q & A:
- How can I convert a string number to a number in Perl?Best solution by Stack Overflow
- How can I transfer my address book from one Yahoo account to a new one?Best solution by Yahoo! Answers
- How can i transfer the address book from one yahoo account to another?Best solution by Yahoo! Answers
- How can I move my yahoo bookmarks from one yahoo account to another yahoo account?Best solution by Yahoo! Answers
- How can I import all my contacts from one hotmail address to another?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.