473,387 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 4994
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mickey | last post by:
Hi, I have a script which works in both IE but is sluggish in Firefox. The script is a simple text scroller. It works perfectly in IE however in Firefox, the text scroll slower and eventually...
5
by: Martin Chen | last post by:
I have a frame set (as per MS FrontPage 2000). It has a contents and a main frame. The contents frame has a menu bar written with with javascript (in the context of a table). In IE6.1 everything...
0
by: Shadow Lynx | last post by:
When using ASP.NET 2.0's built-in TreeView on a page with <BASE target = "AnythingBut_Self"></BASE> in the HEAD, the expand/collapse buttons fail to function. The reason for this is that the...
8
by: johnsonlau | last post by:
When I use document.write to replace the comment of a frame, I found that the page was always showing as loading in Firefox (2.0.0.2). But it seems that it is OK in IE6. Could someone help me...
1
by: =?Utf-8?B?bWdkZXY=?= | last post by:
I've got a lot of modal dialog boxes in my web application that do postbacks. Originally my application was developed in VS 2003 and everything worked fine. Now I'm upgrading to VS 2005 and all...
5
by: Joe Kovac | last post by:
Hi! I want to add <base target="_self"> into the header section of a aspx page. I want to do this in the code behind because I use master pages which I do not want to change directly. Thanks...
1
by: chadmathbiz | last post by:
Hello, and nice to meet all of you: My name's Chad, and I have a head-bashing problem. I built out a photo gallery with very specific mouseover/onclick etc. behaviors. It works fine in Firefox....
5
by: loveshack | last post by:
Can anyone help me please (i am quite a novice, but having fun learning). Im not sure if this is an ASP problem, a javascript problem or a browser problem. Firstly, everything i have written...
2
by: bubs81 | last post by:
Hi, Here's the first line of my HTML form... <form target="_self" onsubmit="return preProcessForm();" action="somewhere" method="post"> preProcessForm looks like... function...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.