469,286 Members | 2,425 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,286 developers. It's quick & easy.

firefox and _self

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?

Mar 6 '07 #1
7 4880
On Mar 6, 1:38 pm, "pbx" <pbei...@gmail.comwrote:
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

Mar 6 '07 #2
pbx
On Mar 6, 12:14 pm, "Walton" <jrhol...@gmail.comwrote:
On Mar 6, 1:38 pm, "pbx" <pbei...@gmail.comwrote:
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
seems to work on IE but not Firefox.

Mar 6 '07 #3
On Mar 6, 2:33 pm, "pbx" <pbei...@gmail.comwrote:
On Mar 6, 12:14 pm, "Walton" <jrhol...@gmail.comwrote:
On Mar 6, 1:38 pm, "pbx" <pbei...@gmail.comwrote:
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

seems to work on IE but not Firefox.
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.

Mar 6 '07 #4
pbx
On Mar 6, 12:37 pm, "Walton" <jrhol...@gmail.comwrote:
On Mar 6, 2:33 pm, "pbx" <pbei...@gmail.comwrote:
On Mar 6, 12:14 pm, "Walton" <jrhol...@gmail.comwrote:
On Mar 6, 1:38 pm, "pbx" <pbei...@gmail.comwrote:
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
seems to work on IE but not Firefox.

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)

Mar 6 '07 #5
pbx said the following on 3/6/2007 5:35 PM:

<snip>
<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.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Mar 6 '07 #6
pbx
On Mar 6, 3:15 pm, Randy Webb <HikksNotAtH...@aol.comwrote:
pbx said the following on 3/6/2007 5:35 PM:

<snip>
<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.

--
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.

Mar 6 '07 #7
On 2007-03-06, pbx <pb*****@gmail.comwrote:
[snip]
><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?
An INPUT element with type="botton" acts as a push button, which
has no default behavior. Clicking on the button triggers the
onclick event.

A BUTTON element without a TYPE attribute has a default type of
SUBMIT. Pressing the button submits the form. Because the FORM
element does not have an ACTION attribute, submitting the form
opens the document containing the FORM.

You want to include type="button" as a BUTTON attribute so the
button acts as a push button rather than a submit button.
Mar 6 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Mickey | last post: by
5 posts views Thread by Martin Chen | last post: by
8 posts views Thread by johnsonlau | last post: by
1 post views Thread by =?Utf-8?B?bWdkZXY=?= | last post: by
5 posts views Thread by Joe Kovac | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.