Javascript, history and Firefox

Hi,

I’m a bit puzzeled by this…

I have an enquiry form that is opened in a pop-up window by the Spawn New Window action, which works fine. The problem is this, I have an error page which opens in the same pop-up window and has a bit of javascript to go back to the form, so that you can correct the errors. It is a bit of html markup after the main message.


<br /><A HREF="javascript:history.go(-1);">Click here to return to the previous page.</A> 

This works fine in Safari 3.2.1, but in Firefox 3 the link back doesn’t work. If you look at the History menu the Back item is greyed out, but if you reload the original Enquiry form again and submit without filling anything in the javascript works. It’s almost as if it is not registering the first page until it is loaded for a second time.

To see what I mean, have a look here and click on the “Enquiry Form” link on the side menu.

http://www.cotswoldengineeringsupplies.co.uk/2008-dev/home.php

The form will be sent if you only fill in your email address, this opens the success page and clicking on the “close and go back” text closes the pop-up and puts the focus back to the page you came from. Not filling in anything and submitting will take you to the error page.

The hope is to have the errors flagged up when you return to the page, but that is something for another day. (the sit will be live soon.

Any light that can be shed on this oddity will be most welcome, as would any solutions!

Regards,

Steve.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

What happens if you just press the Back button? Does it go back to the
previous form page or not?

Walter

On Jan 20, 2009, at 5:14 PM, SteveB wrote:

This works fine in Safari 3.2.1, but in Firefox 3 the link back
doesn’t work. If you look at the History menu the Back item is
greyed out, but if you reload the original Enquiry form again and
submit without filling anything in the javascript works. It’s almost
as if it is not registering the first page until it is loaded for a
second time.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I have an enquiry form that is opened in a pop-up window by the Spawn New Window action, which works fine.

Isn’t the fact that it opens in a “new” window the reason there is no back button?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Each window carries its own history object, and it should start with
the current page. That’s history[0], wherever you go from there would
increment that.

Walter

On Jan 20, 2009, at 5:53 PM, chuckamuck wrote:

I have an enquiry form that is opened in a pop-up window by the
Spawn New Window action, which works fine.

Isn’t the fact that it opens in a “new” window the reason there is
no back button?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I have no idea why this doesn’t work but I feel I should point out that your form page is called ‘Equiry Form’ equiryfrom.php

Just curious why you want this form in a pop up window anyway.

What happens if the users browser is set to block popups?

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

David,

I have pop-ups blocked as a default in both Firefox and Safari, and it still opens the new window as it isn’t an automatically opened window, but one that only opens if the person browsing clicks on a link.

I think it is only Firefox that is showing this behaviour, I haven’t tested it yet on Windows…

I have no idea why this doesn’t work but I feel I should point out that your form page is called ‘Equiry Form’ equiryfrom.php

Just curious why you want this form in a pop up window anyway.

What happens if the users browser is set to block popups?

Chuckamuck & Walter,

The Spawn New Window action is set to not have any buttons in the tool bar, the problem arises if there is an error on the form when you press submit, the error page is loaded, and on this there is a return to your form page that uses the javascript.

The reason for having this enquiry form as a pop-up is that if someone is browsing one of the product lines, and doesn’t see a particular item, they can easily fill in the form whilst still having the page they were looking at available for reference.

I could still put this on a normal page but I feel it would lose some of its usefulness, not being able to refer back to the item you’re enquiring about for instance.

I know that the javascript works because I have it working on the adaptors page as these are still a work in progress.

I have just added all the toolbars etc in the Action and tested it in both Safari and Firefox, and can confirm that in Safari when you are taken to the error page the back button is not greyed out and can be clicked on, whereas on Firefox, when you are taken to the error page the back button on the tool bar is still greyed out.

Is there any way to force Firefox to behave like Safari?

Thanks for the replies, I’m grateful for your help.

Regards,

Steve.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Steve,

I just tried in FF3 and it works fine for me. Are any of your settings
different to the default?

Also, if you know the address of the form why not just link to it
rather than using JavaScript? this will solve the problem on all
browsers.

Cheers,

Joe

On 21 Jan 2009, at 10:16, SteveB wrote:

David,

I have pop-ups blocked as a default in both Firefox and Safari, and
it still opens the new window as it isn’t an automatically opened
window, but one that only opens if the person browsing clicks on a
link.

I think it is only Firefox that is showing this behaviour, I haven’t
tested it yet on Windows…

I have no idea why this doesn’t work but I feel I should point out
that your form page is called ‘Equiry Form’ equiryfrom.php

Just curious why you want this form in a pop up window anyway.

What happens if the users browser is set to block popups?

Chuckamuck & Walter,

The Spawn New Window action is set to not have any buttons in the
tool bar, the problem arises if there is an error on the form when
you press submit, the error page is loaded, and on this there is a
return to your form page that uses the javascript.

The reason for having this enquiry form as a pop-up is that if
someone is browsing one of the product lines, and doesn’t see a
particular item, they can easily fill in the form whilst still
having the page they were looking at available for reference.

I could still put this on a normal page but I feel it would lose
some of its usefulness, not being able to refer back to the item
you’re enquiring about for instance.

I know that the javascript works because I have it working on the
adaptors page as these are still a work in progress.

I have just added all the toolbars etc in the Action and tested it
in both Safari and Firefox, and can confirm that in Safari when you
are taken to the error page the back button is not greyed out and
can be clicked on, whereas on Firefox, when you are taken to the
error page the back button on the tool bar is still greyed out.

Is there any way to force Firefox to behave like Safari?

Thanks for the replies, I’m grateful for your help.

Regards,

Steve.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Joe,

That’s odd. What are the default settings? I’m Using FireFox 3.0.5 English British Version.

The original site also has the same problem: (it’s a Freeway 4.4.2 version and also uses the Spawn New Window Action).

http://www.cotswoldengineeringsupplies.co.uk

The enquiry form is on the side panel, click on it and when the pop-up window opens, press submit and you’re taken to the error page. On FF3 you can’t go back to the previous page, but the link works in Safari.

The only way I have found to get FF3 to go back to the previous page is if you keep the pop-up open and reload it from the original page on the mainsite.

How do you get the same Pop-up effect (window size, no toolbars etc) just by using a normal link? is it with the Extend tab in the Edit Hyperlink dialogue box?

Regards

Steve.

Hi Steve,

I just tried in FF3 and it works fine for me. Are any of your settings different to the default?

Also, if you know the address of the form why not just link to it rather than using JavaScript? this will solve the problem on all browsers.

Cheers,

Joe


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Oh, even more odd, it isn’t working now!

So, leave the Spawn New Window as it is but change the link that uses
the History -1 script to be a link to the form itself, so it would be:

equiryfrom.php

instead of:

javascript:history.go(-1);

Hope this helps.

Joe

On 21 Jan 2009, at 12:29, SteveB wrote:

Hi Joe,

That’s odd. What are the default settings? I’m Using FireFox 3.0.5
English British Version.

The original site also has the same problem: (it’s a Freeway 4.4.2
version and also uses the Spawn New Window Action).

http://www.cotswoldengineeringsupplies.co.uk

The enquiry form is on the side panel, click on it and when the pop-
up window opens, press submit and you’re taken to the error page. On
FF3 you can’t go back to the previous page, but the link works in
Safari.

The only way I have found to get FF3 to go back to the previous page
is if you keep the pop-up open and reload it from the original page
on the mainsite.

How do you get the same Pop-up effect (window size, no toolbars etc)
just by using a normal link? is it with the Extend tab in the Edit
Hyperlink dialogue box?

Regards

Steve.

Hi Steve,

I just tried in FF3 and it works fine for me. Are any of your
settings different to the default?

Also, if you know the address of the form why not just link to it
rather than using JavaScript? this will solve the problem on all
browsers.

Cheers,

Joe


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

But if you do that, the form will clear, rather than holding the last
(incorrect/incomplete) entry for correction.

Try adding just the toolbar and see if Firefox cooperates. I’m not
saying you need to leave it that way, it’s just a troubleshooting step.

Walter

On Jan 21, 2009, at 8:13 AM, Joe Billings email@hidden wrote:

Oh, even more odd, it isn’t working now!

So, leave the Spawn New Window as it is but change the link that
uses the History -1 script to be a link to the form itself, so it
would be:

equiryfrom.php

instead of:

javascript:history.go(-1);

Hope this helps.

Joe

On 21 Jan 2009, at 12:29, SteveB wrote:

Hi Joe,

That’s odd. What are the default settings? I’m Using FireFox 3.0.5
English British Version.

The original site also has the same problem: (it’s a Freeway 4.4.2
version and also uses the Spawn New Window Action).

http://www.cotswoldengineeringsupplies.co.uk

The enquiry form is on the side panel, click on it and when the pop-
up window opens, press submit and you’re taken to the error page.
On FF3 you can’t go back to the previous page, but the link works
in Safari.

The only way I have found to get FF3 to go back to the previous
page is if you keep the pop-up open and reload it from the original
page on the mainsite.

How do you get the same Pop-up effect (window size, no toolbars
etc) just by using a normal link? is it with the Extend tab in the
Edit Hyperlink dialogue box?

Regards

Steve.

Hi Steve,

I just tried in FF3 and it works fine for me. Are any of your
settings different to the default?

Also, if you know the address of the form why not just link to it
rather than using JavaScript? this will solve the problem on all
browsers.

Cheers,

Joe


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

On 21 Jan 2009, at 13:31, Walter Lee Davis wrote:

But if you do that, the form will clear, rather than holding the
last (incorrect/incomplete) entry for correction.

Ahh, I didn’t actually put anything in the fields so didn’t even think
of that!


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Walter

I did think of that, and tried it, but it didn’t work.
also tried it with everything selected, again no joy.

I’ve just tried it with the page reference instead of the javascript, and as you thought it clears the form, so all your details are wiped, not quite what I had in mind.

Back to the drawing board…

Regards

Steve.

But if you do that, the form will clear, rather than holding the last (incorrect/incomplete) entry for correction.

Try adding just the toolbar and see if Firefox cooperates. I’m not saying you need to leave it that way, it’s just a troubleshooting step.

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I think this is happening because FF doesn’t consider clicking a
submit button and being redirected from a script to a page the same as
clicking a link to a page so nothing is being added to the History
object. I’d need to do more testing to see if this was really the case
though.

Joe

On 21 Jan 2009, at 14:13, SteveB wrote:

Hi Walter

I did think of that, and tried it, but it didn’t work.
also tried it with everything selected, again no joy.

I’ve just tried it with the page reference instead of the
javascript, and as you thought it clears the form, so all your
details are wiped, not quite what I had in mind.

Back to the drawing board…

Regards

Steve.

But if you do that, the form will clear, rather than holding the
last (incorrect/incomplete) entry for correction.

Try adding just the toolbar and see if Firefox cooperates. I’m not
saying you need to leave it that way, it’s just a troubleshooting
step.

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Is the error checking happening in JavaScript, or on the server? If
the latter, do you know what kind of a redirect it is doing to get the
error page to show? (What form handler are you using?)

Walter

On Jan 21, 2009, at 9:38 AM, Joe Billings wrote:

I think this is happening because FF doesn’t consider clicking a
submit button and being redirected from a script to a page the same
as clicking a link to a page so nothing is being added to the
History object. I’d need to do more testing to see if this was
really the case though.

Joe

On 21 Jan 2009, at 14:13, SteveB wrote:

Hi Walter

I did think of that, and tried it, but it didn’t work.
also tried it with everything selected, again no joy.

I’ve just tried it with the page reference instead of the
javascript, and as you thought it clears the form, so all your
details are wiped, not quite what I had in mind.

Back to the drawing board…

Regards

Steve.

But if you do that, the form will clear, rather than holding the
last (incorrect/incomplete) entry for correction.

Try adding just the toolbar and see if Firefox cooperates. I’m not
saying you need to leave it that way, it’s just a troubleshooting
step.

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Walter,

The error checking is done by the PHP Feedback Form at the moment (it’s easy to set up but I really want to do better checking so that I can highlight the errors on the form) so it’s server side as the action uploads a php file: enquiryform-go.php to the same folder as the page, and this is what redirects the page. Still don’t understand why the success page gets through.

Regards,

Steve.

On 21 Jan 2009, 2:13 pm, waltd wrote:

Is the error checking happening in JavaScript, or on the server? If
the latter, do you know what kind of a redirect it is doing to get the
error page to show? (What form handler are you using?)

Walter

On Jan 21, 2009, at 9:38 AM, Joe Billings wrote:

I think this is happening because FF doesn’t consider clicking a
submit button and being redirected from a script to a page the same
as clicking a link to a page so nothing is being added to the
History object. I’d need to do more testing to see if this was
really the case though.

Joe

On 21 Jan 2009, at 14:13, SteveB wrote:

Hi Walter

I did think of that, and tried it, but it didn’t work.
also tried it with everything selected, again no joy.

I’ve just tried it with the page reference instead of the
javascript, and as you thought it clears the form, so all your
details are wiped, not quite what I had in mind.

Back to the drawing board…

Regards

Steve.

But if you do that, the form will clear, rather than holding the
last (incorrect/incomplete) entry for correction.

Try adding just the toolbar and see if Firefox cooperates. I’m not
saying you need to leave it that way, it’s just a troubleshooting
step.

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

and it still opens the new window as it isn’t an automatically opened window, but one that only opens if the person browsing clicks on a link.

You of course are absolutely right that popup blockers only block unrequested popups.

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options