1

I am working on a simple javascript program that searches for a wine review on one or several websites based on which sites the user is interested in.

My problem is that the window.open command only opens the first website chosen by the user and seems to be unable to open the others. Also, after scrolling through the urls of the sites listed, I get an error message saying: 405 - Method Not Allowed

You can check the program out at: http://www.divinocards.com/search_engine_4.htm

I have spent several hours trying to figure out why the program is stalling as it is. I have used the debugger and it seems that all values are being correctly assigned. It's is just that I am unable to open multiple windows. It doesn't seem to be an issue with pop-up blockers either as I temporarily disabled those.

Any help would be greatly appreciated.

Sincerely, OB

2 Answers 2

1

Change the type attribute of input from submit to button (for input with name="Find" and, in fact, all inputs that you use through JavaScript exclusively, i.e. not doing a real submit to server).

More details - your form doesn't have an action attribute. Take a look here:

What happens in your current code when you click on "Find" button is that you are doing a submit to an unknown location. As per the standard:

this attribute is required (look at section 17.3 The FORM element).

The details in the section also explain why it redirects to "nowhere":

action = uri [CT]
    This attribute specifies a form processing agent. User agent behavior for a value other than an HTTP URI is undefined.

So, at the end it's up to a specific browser to decide what to do here (an implementation detail, not something you want to rely on).

Sign up to request clarification or add additional context in comments.

1 Comment

That was it! Thank you so much for your help. All these hours spent thinking about the problem and it was only the matter of a simple "button". YOU ROCK!
0

If you just want to open a target window, you can remove your <form> tag , and add a click event to the find button.

Set <input> tag's type attribute to button can't prevent form submit by use press enter in the text field

You can also disable onsubmit event of the form.

like

document.forms[0].onsubmit = function(){return false;}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.