I have some code to edit a document within an iFrame: |window.location=“http://”+serverName+“/”+webDBName+“/0/”+unid+“?EditDocument”;|The code works fine in IE. In firefox, I get redirected to a page where the |?EditDocument| is replaced with a query string that contains values for all of the fields on the form. The page doesn’t load and I’m directed to a page not found error. If I capture the URL, remove the querystring and open the document in it’s own window, the URL is OK.
Subject: window.location redirect in firefox
That’s truly odd, but I can’t tell exactly how odd it is without more context. The URL that you describe sounds like the form is being submitted with GET as the method; the question is – what might be calling the submission?
That being said, Firefox (and other browsers) are a little more picky than IE about JavaScript. window.location is an object, not a string, and what you are trying to set is the href property of the object, not the object itself:
window.location.href = ;
If you are simply trying to put the current document into edit mode, there is a much simpler way:
window.location.search = “?EditDocument”;
Are you running the code from a document event (onclick, etc.)? If it’s a button onclick or anything else that would normally submit a form (like Enter in a single field), you have to remember to return false to keep the event from bubbling.
Subject: RE: window.location redirect in firefox
I was using a button element. I switched to a div with an onclick event and I don’t have any problems. Thanks again Stan. If IBM isn’t paying you, they should.