473,398 Members | 2,212 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,398 software developers and data experts.

window.open works in Firefox but not IE6/7

20
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 6816
chaarmann
785 Expert 512MB
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
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 Expert Mod 8TB
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 Expert Mod 8TB
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 Expert 512MB
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 Expert Mod 8TB
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
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...
5
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> .......
8
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...
44
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...
13
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...
3
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...
4
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','');...
6
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...
13
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
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,...
0
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...

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.