473,536 Members | 2,993 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

window.open works in Firefox but not IE6/7

20 New Member
Hi, i have tried this code in FireFox and it works great. However , it seems to fail in IE6/7. I have no idea and looking for help here. Please advice. Thank you.
Expand|Select|Wrap|Line Numbers
  1. <a
  2. ONCLICK="window.open('http://www.google.com,'height=180','width=250','location=no','menubar=no','resizable=no','scrollbars=yes','status=no','toolbar=no')" href="javascript:void(0)">
  3. Whois Agent local</a>
Jan 7 '08 #1
6 6820
chaarmann
785 Recognized Expert Contributor
This code is programmed bad. Why do you need an "onclick"-event if your "href" is already reacting to the click? You disabled the clicking by using href="javascript:void(0)". So no wonder the browser gets confused and reacts differently on this error.
Just use
Expand|Select|Wrap|Line Numbers
  1. <a href="javascript:window.open(...)>Whois Agent local</a>
and it should work in all browsers.

If it still does not work, then check your configuration (for example if you have disabled javascript in your brower)

Hi, i have tried this code in FireFox and it works great. However , it seems to fail in IE6/7. I have no idea and looking for help here. Please advice. Thank you.
Expand|Select|Wrap|Line Numbers
  1. <a
  2. ONCLICK="window.open('http://www.google.com,'height=180','width=250','location=no','menubar=no','resizable=no','scrollbars=yes','status=no','toolbar=no')" href="javascript:void(0)">
  3. Whois Agent local</a>
Jan 7 '08 #2
DannyMc
20 New Member
Thank you Chaarmann, Your method seems to be more effective way to the javascript. However, i am still facing the same problem even using your suggested way.

here is my function in php:
Expand|Select|Wrap|Line Numbers
  1. function open_me1(){
  2. window.open('http://www.google.com','height=300','width=250','location=no','menubar=no','resizable=no','scrollbars=yes','status=no','toolbar=no');
javascript:
Expand|Select|Wrap|Line Numbers
  1. <a href="javascript:open_me1();">Click To google</a><br />
I manage to call the function in FireFox with no error message recorded in Error Console. On the other hand, IE6/7 the error message is invalid argument. This is weird.
Jan 7 '08 #3
acoder
16,027 Recognized Expert Moderator MVP
window.open() only has 3 or 4 parameters. The first is the URL. The second is the name of the window. The third specifies the properties. You've split these up into their own arguments - they should be grouped together as one. See, for example, this link.
Jan 7 '08 #4
acoder
16,027 Recognized Expert Moderator MVP
This code is programmed bad. Why do you need an "onclick"-event if your "href" is already reacting to the click? You disabled the clicking by using href="javascript:void(0)".
You should always use the href of a link in case JavaScript is disabled. It should really point to a real URL (in this case google.com). In the onclick, you can prevent the browser following the href link using return false. If you program like this, it will work whether JavaScript is enabled or not.
Jan 7 '08 #5
chaarmann
785 Recognized Expert Contributor
You should always use the href of a link in case JavaScript is disabled. It should really point to a real URL (in this case google.com). In the onclick, you can prevent the browser following the href link using return false. If you program like this, it will work whether JavaScript is enabled or not.
Cool, I learned something new today. Especially that you can disable the href by returning "false" in your onClick. But that also means that the onClick is executed first. Is this the case in all common browsers?
Jan 8 '08 #6
acoder
16,027 Recognized Expert Moderator MVP
Cool, I learned something new today. Especially that you can disable the href by returning "false" in your onClick. But that also means that the onClick is executed first. Is this the case in all common browsers?
Yes, if JavaScript is enabled. If it's disabled, the href link will be followed. See these usability issues/tips for more information.
Jan 8 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

4
6315
by: Andrew Poulos | last post by:
If I use this code to maximise a browser window: window.moveTo(0,0); window.resizeTo(screen.width,screen.height); it works but on Windows the user can have a taskbar visible and the browser window goes behind it. Is there a way to know where the taskbar is?
5
31206
by: Derek Erb | last post by:
I am banging my head against the wall with this one. The following code snippets work perfectly fine in MSIE6. But produce an error in Firefox and do not work at all. BROWSER.HTM <HTML> .... <div class="Abb"> <h2 id="ABTit">BROWSER</h2> </div>
8
5623
by: Dominic Tocci | last post by:
I'm searching for a way to use window.open on my web page to open a window in firefox that allows the sidebars to work (bookmarks, history, etc). When I use the following: var popWindow=window.open('http://www.yahoo.com','','width=600,height=400,toolbar=1,location=1,menubar=1,resizable=1,titlebar=1,directories=1,status=1,scrollbars=1'); the...
44
9387
by: Viken Karaguesian | last post by:
Hello all, On occasion I want to open hyperlinks (images, etc.) in a new window. In the past, I've used target="_blank" to open the link in a new window. However, using the "target" attribute causes my pages to fail validation (strict doctype). The validator says "There is no attribute 'target'.." So...how do I open a link in a new...
13
22147
by: tochiromifune | last post by:
Hello The window.open method brings my window to the top only if it is new. If it's being reused, the window does not come to the foreground (with IE 6 it does). Is there a new way in Mozilla/Firefox that I can ensure that this window comes to the top? Thank you for your help
3
2100
by: kosmodisk | last post by:
Hi, I'm having problem accessing javascript-created elements from opened window. This occurs only when I'm including another files in opened window, javascript or css. When I comment out "<link>" and "<script>" (point (0)), the script works fine. The opening window itself (point (1)) can access the object. When page has been loaded, then...
4
10306
by: Andre | last post by:
With Firefox 1.5+, I used the following code to close a window/tab: === <html><head> <script language="javascript" type="text/javascript"> function closeWindow() { window.open('','_parent',''); window.close(); } closeWindow(); </script></head><body></body></html>
6
2025
by: Howard Rifkin | last post by:
Hi, I my Javascript I popup an authentication window using the command; unamePasswdWindow = open("auth.html","","width=500,height=100"); This works fine in IE, and in Firefox 2.x on Windows and Linux, but the open() just returns a null in Firefox 1.5 on Tru64 Unix.
13
3211
by: amymcdo3 | last post by:
Hi Everyone, I have a popup window that opens when clicking a link. The pop up window asks a question and supplies two buttons, Yes and No. The buttons are images and when the user clicks the button, they will either be linked to another page via the Yes button or they will stay on the same page if they click the No button. The popup window...
0
7359
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7530
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7680
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7273
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5821
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5211
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1752
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
918
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.