Adding data to URL for bookmarking

T

timothytoe

My URL usually looks something like this (of course with much more
data)...

http://www.site.com/page.php?data=AAAGX

The data is mandatory.

If someone comes into this page like this (without the data)...

http://www.site.com/page.php

....then I check a cookie to see what the most recent data was and
proceed. If there's no cookie, I send them back to where they enter
the data.

This works just fine, except without the data visible in the URL, the
user can't copy, bookmark, email, etc. the URL (an important ability
to have in this case).

Can I tack the data onto the URL so it's visible in the browser
address bar without a page reload? Or will I have to force a page
reload?
 
D

David Dorward

timothytoe said:

Please use example.com for example URIs.
If someone comes into this page like this (without the data)...
http://www.site.com/page.php
...then I check a cookie to see what the most recent data
This works just fine, except without the data visible in the URL, the
user can't copy, bookmark, email, etc. the URL (an important ability
to have in this case).

Can I tack the data onto the URL so it's visible in the browser
address bar without a page reload?

No.

.... but don't load the whole page. Test to see if it is set before
generating any content, if it isn't then redirect - and do it with the PHP
location header, not JavaScript.
 
D

David Dorward

David said:
then redirect - and do it with the PHP
location header, not JavaScript.

Obviously I mean the HTTP location header and the PHP header function.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top