473,378 Members | 1,512 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,378 software developers and data experts.

How to use window.open() ?

Les
Hi,

I'd like to find out how to use the window.open() script in Fireworks MX. I have posted my question in the Fireworks forum but
didn't get any replies. Since it's javascript, maybe someone could help me here...?

I'd like to use the window.open() script to open a separate window, because I'd like to hide the menubar and specify the
window size as well. So I specify "javascript:window.open(...)" as the HTML link for a hotspot. However, when I test it, I get 2
windows open. One of them is the actual window which was specified by the open() script and that contains what I need, but I have
another window opens as well, which says "[object]".

Why is this other window opens up? How can I get rid of that? Is there's something wrong with the way I specified the
"window.open()" string in the link box. Can anyone tell me what is the correct way?

Thanks!

Les

Jul 20 '05 #1
6 8205
Lee
Les said:

Hi,

I'd like to find out how to use the window.open() script in Fireworks MX. I have
posted my question in the Fireworks forum but
didn't get any replies. Since it's javascript, maybe someone could help me
here...?

I'd like to use the window.open() script to open a separate window, because I'd
like to hide the menubar and specify the
window size as well. So I specify "javascript:window.open(...)" as the HTML link
for a hotspot. However, when I test it, I get 2
windows open. One of them is the actual window which was specified by the open()
script and that contains what I need, but I have
another window opens as well, which says "[object]".

Why is this other window opens up? How can I get rid of that? Is there's
something wrong with the way I specified the
"window.open()" string in the link box. Can anyone tell me what is the correct
way?


Your mistake is in the use of the javascript: protocol. By design, it
replaces the contents of the current window with the evaluation of the
expression. The expression "window.open(...)" evaluates to a window
object, which appears in the current window as "[object]".

You can prevent this by either making sure that the expression evaluates
to void, in which case the current window contents are not changed:
javascript:void(window.open(...))
would probably do that.

Better practice would be to avoid using the javascript: protocol, and
to use the onClick event handler, as in:

href="#" onclick="window.open(...);return false"

The ";return false" tells the browser not to load the value of the
HREF attribute.

Jul 20 '05 #2
Lee wrote:
Better practice would be to avoid using the javascript: protocol, and
to use the onClick event handler, as in:

href="#" onclick="window.open(...);return false"


No, bester practise would be to make the href a useful URI ...

href="myfile" onclick="window.open(this.href); return false;"

.... better yet would be avoid opening a new window altogether.

--
David Dorward http://dorward.me.uk/
Jul 20 '05 #3
Lee
David Dorward said:

Lee wrote:
Better practice would be to avoid using the javascript: protocol, and
to use the onClick event handler, as in:

href="#" onclick="window.open(...);return false"


No, bester practise would be to make the href a useful URI ...


Normally, I would have said so, but the context seems to be an automated
menu system, so JavaScript seems to be a requirement, anyway.

Jul 20 '05 #4
DU
Lee wrote:
David Dorward said:
Lee wrote:

Better practice would be to avoid using the javascript: protocol, and
to use the onClick event handler, as in:

href="#" onclick="window.open(...);return false"


No, bester practise would be to make the href a useful URI ...

Normally, I would have said so, but the context seems to be an automated
menu system, so JavaScript seems to be a requirement, anyway.


Where did you get that impression? Even if it was a menu system, why
would it make any difference? Why would "javascript" be an adequate
requirement for the value of an href attribute? "javascript" is still
not a valid protocol.

Top Ten Web-Design Mistakes of 2002
6. JavaScript in Links
http://www.useit.com/alertbox/20021223.html

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunc...e7Section.html

Jul 20 '05 #5
Les
Thanks guys, I will try it.
Jul 20 '05 #6
JRS: In article <vn************@corp.supernews.com>, seen in
news:comp.lang.javascript, Les <ju******@nowhere.net> posted at Tue, 30
Sep 2003 14:57:15 :-

I'd like to find out how to use the window.open() script in Fireworks MX. I have
posted my question in the Fireworks forum but
didn't get any replies. Since it's javascript, maybe someone could help me
here...?


By composing text within a right margin of about 72 characters, in
accordance with standard Usenet recommendation, you can make your
material more readily readable to those with standard 72-column eyes or
80-column display windows.

<FAQENTRY> Jim, I don't see a mention of posting margin or line-wrap in
2.3 </FAQENTRY>.

--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> JS maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.
Jul 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Michael | last post by:
I am trying to allow a user to view a PDF in a new window. I currently have this working using the following: <a href="./pdf.do?parameter=01121980" target="top"><b>pdf</b></a> The problem...
13
by: Kai Grossjohann | last post by:
It seems that Ctrl-N in Mozilla opens a new empty browser window. That's fine, I don't need to do anything about it. But Ctrl-N in IE appears to clone the current window. Is there a way to...
10
by: Marshall Dudley | last post by:
When I do the following line in Netscape, the popup loads as it should, but the parent window usually, but not always, reloads as well. <a href="#"...
2
by: Samir Pandey | last post by:
Hello, I am using the following javascript code to open a new window. Somehow, IE always opens a new window. It doesn't open target url in the window name given. All i want is, if there is a...
3
by: NeverLift | last post by:
But, if it's not open, I don't want to open it . . . using window.open will open it if it doesn't exist, even if the url in that open is null (the window is then empty -- but it's open). The...
14
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a...
6
by: G Dean Blake | last post by:
in my aspx app I am writing a stream that works fine but it replaces what is in the client browser window. The code is as follows: .. .. HttpContext.Current.Response.ClearHeaders()...
8
by: johnsonholding | last post by:
Here is the code for a pop-up window that works in Firefox and not in IE - I get a java error or something, Here is the code : </script> <SCRIPT language="JavaScript"...
7
by: anthony.turcotte | last post by:
Hi, I've looked for a solution to this problem on google, read posts in this newsgroup and I still haven't found anything that could help me. Here's the scenario. 1. User accesses...
3
by: Andrew Poulos | last post by:
There's a HTA application that's running on a local computer (not from a URL) and the user can open a new HTML window by clicking a button The first time the user clicks the button the window...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
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...

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.