Hello.
In my form I have suppressed the usual submit action and I construct a string from the various inputs before calling 'window.open' with the string appended for a Google search.
Is there likely to be any difference in speed between 'window.open' and using the form's submit action? There is a slight delay before the search page opens.
I realise that the (slight) delay is most likely caused by my code constructing the string (and my broadband dongle) but I'm just curious.
(I was at one stage tempted to create a hidden form and place my string in a text input and then simulate clicking the submit button. But it's only a very slight delay and this seems an overly complicated approach.)
Andy.
Faster form submission
-
- SilverLounger
- Posts: 2403
- Joined: 05 Feb 2010, 22:21
- Location: London ENGLAND
Faster form submission
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
-
- 2StarLounger
- Posts: 148
- Joined: 26 Dec 2010, 18:17
Re: Faster form submission
I can't recall seeing any benchmark comparisons. The only difference that springs to mind is that popup blockers are much more sensitive about window.open() than target="_blank".
-
- SilverLounger
- Posts: 2403
- Joined: 05 Feb 2010, 22:21
- Location: London ENGLAND
Re: Faster form submission
Hi and thanks.
I've decided that the very slight pause is just me being a perfectionist. I now doubt if there would be any noticable difference if I were to use a hidden form. Besides which it would be a bit of a minefield trying to simulate clicking a submit button.
Andy.
I've decided that the very slight pause is just me being a perfectionist. I now doubt if there would be any noticable difference if I were to use a hidden form. Besides which it would be a bit of a minefield trying to simulate clicking a submit button.
Andy.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
-
- 2StarLounger
- Posts: 148
- Joined: 26 Dec 2010, 18:17
Re: Faster form submission
Actually, it's shockingly easy (shocking from the perspective of scripts hijacking your user experience right under your nose). I think you might just need to...agibsonsw wrote:Besides which it would be a bit of a minefield trying to simulate clicking a submit button.
Code: Select all
document.getElementById("mysubmitbutton").click();
-
- SilverLounger
- Posts: 2403
- Joined: 05 Feb 2010, 22:21
- Location: London ENGLAND
Re: Faster form submission
That is a little shocking. I thought I read somewhere that it was tricky to push Submit - but obviously not. Andy.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.