Forum Moderators: open
file.php?prompt=sitethemes?prompt=sitechatroom?prompt=sitechatroom
Here is an example of the functions associated with those HTTP queries...
function sitechatroomshow() {location.href = location.href + '?prompt=sitechatroom';}
function sitethemesshow() {location.href = location.href + '?prompt=sitethemes';}
How do I mode these functions to include the current URL without any attaching any already present HTTP queries?
- John
// Select everything before first '?'
location.href = location.href.replace( /^(.*?)\?.*$/, "$1");
// Or, delete any text matching location.search
location.href = location.href.replace( new RegExp( location.search), "$1");
The location object has many useful properties, try this on one of your pages:
alert( location.protocol +"\n"+ location.host +"\n"+ location.pathname +"\n"+ location.search);