/    Sign up×
Community /Pin to ProfileBookmark

Javascript history.go(-1) Problem

My demo URL is as follows:

[URL=http://www.vans.riverlandpages.com/cgi-bin/CSVhit/csvhit.cgi?show=1000015&mytemplate=tp1]http://www.vans.riverlandpages.com/cgi-bin/CSVhit/csvhit.cgi?show=1000015&mytemplate=tp1[/URL]

The initial javascript for the “page” Tabs came from:
[URL=http://www.dhtmlgoodies.com/index.html?whichScript=tab_view]http://www.dhtmlgoodies.com/index.html?whichScript=tab_view[/URL]

All Tabs within the page are actually DIVs.

When you select the “Tell-A-Friend” Tab and submit it incorrectly, you can use the “go back” button to go back and complete the form again, however, if you submit it incorrectly again and then “go back”, when you go back the page display is all out of whack.

This only happens when using Internet Explorer.

my form code is:

[CODE]
<form name=’back’>
<input type=’button’ class=’button’ onClick=’javascript: history.go(-1)’ value=’ [ Back one Page ] ‘>
</form>
[/CODE]

Can anyone suggestion a solution that can fix this problem?

Thanks in advance.

Jardry

to post a comment
JavaScript

12 Comments(s)

Copy linkTweet thisAlerts:
@KeveyMay 05.2006 — Yours look fine to me...

Here's mine:

[CODE]<input type='button' value='go back' class='formbut' onclick='history.go(-1)' />[/CODE]

It doesn't give me any trouble in IE or FF. Also, mine is not enclosed in <form></form>...it just sits in a div.
Copy linkTweet thisAlerts:
@JardryauthorMay 05.2006 — Kevey,

If you have the time to check the URL, you'll see what the problem is that I am referring to. I'm stumped as to why the problem I am reporting only occurs when using IE.

Jardry
Copy linkTweet thisAlerts:
@KeveyMay 05.2006 — I see what you mean with it going back to the car detail instead of the form itself. It's more like it's going back 2 pages vice 1. I think it has to do with the form being a part of the same URL, so when you go back one, it goes to history and one page back is the car detail, and not the tab you click to get to the tell-a-friend page.

As far as a fix I am not sure...anyone?
Copy linkTweet thisAlerts:
@JardryauthorMay 05.2006 — Edited initial post to include URL of the javascript source for the "page" Tabs on the URL in which I am having the problem.

The "Tell-A-Friend" form is on the display page which then processed the tell a friend php file which displays the error message(s). Going back 1 should work as it is really only going back one page.

I suspect that the "page" Tabs javascript may be causing a conflict. I have tried leaving a message on their forum but responses are very, very slow.

Jardry
Copy linkTweet thisAlerts:
@felgallMay 05.2006 — Also, mine is not enclosed in <form></form>...it just sits in a div.[/QUOTE]

Which makes it invalid HTML and some browsers and lots of search engines will choke on your page source.
Copy linkTweet thisAlerts:
@JardryauthorMay 05.2006 — Which makes it invalid HTML and some browsers and lots of search engines will choke on your page source.[/QUOTE]

Can we please keep the comments on the topic rather than hijack the thread because someone may not have used valid code.

Has anyone experienced the problem I have referred to, and if so, how were they able to resolve it?

Thanks.

Jardry
Copy linkTweet thisAlerts:
@felgallMay 05.2006 — Some browsers keep track of which tab you had open when you go back to the prior page so that the page displays exactly as you last saw it. Some don't heep that much info about the page and so you see the default version the same as when you first loaded the page.

To get a consistent result between browsers you need to save the page state in a cookie so that when people return to the page that it displays in the desired state. IE is well known for doing things differently from other browsers - especially with things like this.
Copy linkTweet thisAlerts:
@wasim___drushtiMay 05.2006 — You are trying to display the error message on a separate Page, Instead of doing this use javascript form validations & validate the form on the same page. Display a dialog box (alert dialog box) when there is any error. What will happen is that the user will not get redirected to a newpage. Even if he enters any incorrect data he can check it on the same page it self. There will be no need of adding a BACK button.
Copy linkTweet thisAlerts:
@JardryauthorMay 05.2006 — I appreciate all your comments, but I have no programming knowledge.

What would be required to incorporate a cookie so that IE goes back correctly?

Jardry
Copy linkTweet thisAlerts:
@wasim___drushtiMay 05.2006 — Why are you trying to make the code more complex. There is no need to incorporate cookies. If you wish, I can guide you with the Form Validations
Copy linkTweet thisAlerts:
@JardryauthorMay 05.2006 — Wasim,

I would really appreciate that.

Let me know when you have some time to assist.

Jardry
Copy linkTweet thisAlerts:
@KeveyMay 05.2006 — Sorry J, you're right....edited due to thread hijacking...
×

Success!

Help @Jardry spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...