firefox and _self

P

pbx

if I try:

window.open(url, "_self");

in firefox (2.0x), firefox just refreshes the current window, it
doesn't "goto" the url.

this works fine in IE 6 or 7.

anyone know what the deal is or a suitable workaround?
 
W

Walton

if I try:

window.open(url, "_self");

don't use window.open here. if you want to change the url of the
current page and not open a new one i would use the location object.

location.href=url
 
P

pbx

don't use window.open here. if you want to change the url of the
current page and not open a new one i would use the location object.

location.href=url

seems to work on IE but not Firefox.
 
P

pbx

save this to a file and try it in firefox.

<html>
<head>
</head>
<body>
<input type="button" onclick="location.href='http://www.google.com'"
value="google"/>
</body>
</html>

is working for me.

me too. but this isn't:

<html>
<head>
</head>
<body>
<form>
<input type="button" onclick="location.href='http://www.google.com'"
value="google"/>
<button onclick="location.href='http://www.google.com'">google 2</
button>
</form>
</body>
</html>

the second button that is. 2nd button doesn't work in firefox but
works fine in IE. do you know why?

(my button mark up is being generated by ASP.NET)
 
R

Randy Webb

pbx said the following on 3/6/2007 5:35 PM:

<form>
<input type="button" onclick="location.href='http://www.google.com'"
value="google"/>
<button onclick="location.href='http://www.google.com'">google 2</
button>
</form>
</body>
</html>

the second button that is. 2nd button doesn't work in firefox but
works fine in IE. do you know why?

A BUTTON element has a default type of SUBMIT, IE gets it wrong, and
with it as a child of the form it is submitting the form when you click it.
(my button mark up is being generated by ASP.NET)

Either have ASP.NET specify it as type="button", move it outside the
form or add return false to the onclick handler.
 
P

pbx

pbx said the following on 3/6/2007 5:35 PM:




A BUTTON element has a default type of SUBMIT, IE gets it wrong, and
with it as a child of the form it is submitting the form when you click it.


Either have ASP.NET specify it as type="button", move it outside the
form or add return false to the onclick handler.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/

yes, it pretty much looks like a submit...

you can't easy move the mark up outside of the form, but for others
wondering you can use a HtmlInputButton control to generate a correct
(input style) button.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top