Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you limit the scope of HISTORY.GO ?

Status
Not open for further replies.

polly297

MIS
Oct 11, 2000
5
GB
Hi..
quick question required please :)

I am using tailor made BACK and FORWARD buttons, and I want to be able to limit the history.go(-1) function so that when a certain page is reached...an message is displayed instead of actually displaying the page held in history.

Here is a quick summary of what happens and what I want it to do..

-Pages are in frames...back & forward buttons in top frame.

-User required to login in order to gain access to the system.

-User then uses menu options to navigate the site, of which content is displayed in the MainBody.

-They can use the Back and forward buttons (which work ok) but when the logon page is reached again, I do NOT want this to be displayed.

Is there any way of doing this?
I suppose I could write a function...except that I am not very good at them :)

any ideas anyone?
Cheers
Emma
 
Not sure how you're posting your login information. Probably using the POST method which is going to place your login page in history. If you're willing to post your login information using the QueryString collection, you can use the location.replace("validatelogin.cgi") and the calling page, in this case the login page, will not be in history.

Try this in your login page...

Code:
// Navigates from the login page to different page that
// get's login information.

function postlogin(form_obj) {
     location.replace("validatelogin.asp?ID=" + form_obj.userid.value)
}

By doing this, the login page won't be in history and won't even be available via the back button or the history drop down menu. Because you're probably posting the login information using the POST method in your form, the Form collection won't be available. Therefore, you need to access your login information using the QueryString collection which you will dynamically create when the user clicks the login button. Instead of sending the data with the submit command, just call the function above which will dynamically create the URL and send the userid in the QueryString collection. Notice I used a form reference in the function name so your login button would need to look like this.

Code:
<input type=&quot;button&quot; value=&quot;Login&quot; onClick=&quot;postlogin(this.form)&quot;;>

Use those actual words &quot;this.form&quot;. That way a reference to the form is sent to the funtion. Make sure that the information you want to access in the function using the form_obj reference is located between the same <form> </form> tags as the login button.

That's the only way that I can think of to achieve your goal. If you're using frames from the get go, you'll need to use that reference.

Code:
frame_ref.location.replace(&quot;webpage.htm&quot;)

If you're sending spaces or unusual characters in the information that you're sending to the page that validates the login, you'll need to encode that information properly for a URL. Let me know if this sounds like something you want to do and I'll get the code for you.

I'll mark this thread. Let me know if you have any other questions or thoughts.

ToddWW
 
Thanks Todd..
except that you have lost me completely! :)

I understand what you are suggesting, I am not sure dont know how to implement it.

Yes the information is being submitted by a Form using POST method. I have developed this all in ColdFusion with bits of Javascript.

The form will pass the username to the form action page as a string - so will it still be in this format?:

function postlogin(form_obj) {
location.replace(&quot;formaction_logonfr.cfm?username=&quot; + form_obj.userid.value)
}

The username value is made up of an email address (firstname.surname@company.com)

- does that constitute unsual characters??

Thanks for your help,
Emma

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top