We help IT Professionals succeed at work.

How to remove the query string from url

Scott Bennett
on
Is there a way, perhaps using <cfheader>, to reomve the query string from the url that appears on the users address bar.
Comment
Watch Question

Commented:
Commented:
I dont't think it is possible.
Would it be possible to use session variables, or have a javascript function included in each page to submit a form with hidden fields in order to navigate to the next page. Each link on the site would call the function passing the url to navigate to.

As an alternative, if you just don't want the url string visible in the browsers address bar you could consider making your site into a frameset with a single frame, so regardless of where the user navigates, the address in the bar will always be the root of your site.

If you want to completely hide the url string you will need to manipulate the status bar at the bottom, or the user will see the mouseover addresses on hyper links.
Top Expert 2008

Commented:
what about this:

----- trim_query.cfm ----

<cfparam name=session.url_id>

<cfif isdefined('url.id')>
  <cfset session.url_id=url.id>
  <cflocation url=trim_query.cfm>
</cfif>

<cfoutput>
Got the url_query is #session.url_query#

Use the following url.ID:
<ul>
<li><a href="trim_query.cfm?id=1">1</a>
<li><a href="trim_query.cfm?id=2">2</a>
<li><a href="trim_query.cfm?id=3">3</a>
<li><a href="trim_query.cfm?id=4">4</a>
</ul>
</cfoutput>

you could do this for each part of the query_string, or you could save the whole query_string as a session variable, and parse that var in your cfscripts...?

cheers.

Commented:
I would have to agree with jamathon on this, you cannot manipulate what is showing in the address bar.

You can hide it (sort of) using frames.

CJ
Scott BennettManager Technology

Author

Commented:
Thanks guys I guess I will go with frames.

Regards,
Scott

Explore More ContentExplore courses, solutions, and other research materials related to this topic.