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

FAQ Topic - How do I open a new window with javascript?

-----------------------------------------------------------------------
FAQ Topic - How do I open a new window with javascript?
-----------------------------------------------------------------------

New windows can be opened on browsers that support the
« window.open » function and are not subject to the action of any
pop-up blocking mechanism with code such as:-

if(window.open){
wRef = window.open("http://example.com/page.html","windowName");
}

http://www.infimum.dk/HTML/JSwindows.html
===
Postings such as this are automatically sent once a day. Their
goal is to answer repeated questions, and to offer the content to
the community for continuous evaluation/improvement. The complete
comp.lang.javascript FAQ is at http://www.jibbering.com/faq/.
The FAQ workers are a group of volunteers.

Nov 20 '06 #1
4 1481
In comp.lang.javascript message
<45***********************@news.sunsite.dk>, Tue, 21 Nov 2006 00:00:02,
FAQ server <ja********@dotinternet.bewrote:
>-----------------------------------------------------------------------
FAQ Topic - How do I open a new window with javascript?
-----------------------------------------------------------------------

New windows can be opened on browsers that support the
‹ window.open › function and are not subject to the action of any
pop-up blocking mechanism with code such as:-

if(window.open){
wRef = window.open("http://example.com/page.html","windowName");
}

Perhaps it would be worth adding to that code a minimal statement to
write
into a specific element

wRef.document.getElementById("X").innerHTML = "Z" // to <p ID=X>

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk DOS 3.3, 6.20 ; WinXP.
Web <URL:http://www.merlyn.demon.co.uk/- FAQqish topics, acronyms & links.
PAS EXE TXT ZIP via <URL:http://www.merlyn.demon.co.uk/programs/00index.htm>
My DOS <URL:http://www.merlyn.demon.co.uk/batfiles.htm- also batprogs.htm.
Nov 22 '06 #2
Dr J R Stockton wrote:
>-----------------------------------------------------------------------
FAQ Topic - How do I open a new window with javascript?
-----------------------------------------------------------------------
<snip>
Perhaps it would be worth adding to that code a minimal statement to write
into a specific element

wRef.document.getElementById("X").innerHTML = "Z" // to <p ID=X>
I would think that, by nature, a FAQ entry should address only one
topic. It is my understanding that opening a window, accessing some
other document and modifying a document structure are three different
matters, identified as such in the current version of the FAQ. Would you
use that very example for all of them? :)
Nov 23 '06 #3
In comp.lang.javascript message <45**********************@news.free.fr>,
Thu, 23 Nov 2006 02:17:34, Elegie <el****@invalid.comwrote:
>Dr J R Stockton wrote:
>>-----------------------------------------------------------------------
FAQ Topic - How do I open a new window with javascript?
-----------------------------------------------------------------------

<snip>
>Perhaps it would be worth adding to that code a minimal statement to write
into a specific element
wRef.document.getElementById("X").innerHTML = "Z" // to <p ID=X>

I would think that, by nature, a FAQ entry should address only one
topic. It is my understanding that opening a window, accessing some
other document and modifying a document structure are three different
matters, identified as such in the current version of the FAQ. Would
you use that very example for all of them? :)

Anyone wanting to open a new *empty* window is very likely to want to
write to it (wRef.document.body.innerHTML=Str does that, for me).

A recent questioner seemed to want to have a new window containing in
part standard text and in part customised text, for which the quoted
code could be used.

In general, where a number of questions are likely to occur together or
in succession, they can often better be answered together. That may
mean that, while the enlarged entry is a replacement for the original
and should inherit its position in the FAQ, it may need a new Subject
line - "How do I open and use a new window with javascript?" maybe.

ISTM that the fiction that every FAQ Section 4 entry necessarily
corresponds exactly to a specific question once asked should be
abandoned - "Opening and using a new window with javascript?". Instead,
the quasi-questions should be adapted to fit the most useful answers.

However, if Section 4 elements, such as 4.42, were deemed subdivisible
into 4.42.1, 4.42.2, ... then different subdivisions might well be used.
Several existing sub sections of could then be grouped within the
concept of "window-handling".

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk DOS 3.3, 6.20 ; WinXP.
Web <URL:http://www.merlyn.demon.co.uk/- FAQqish topics, acronyms & links.
PAS EXE TXT ZIP via <URL:http://www.merlyn.demon.co.uk/programs/00index.htm>
My DOS <URL:http://www.merlyn.demon.co.uk/batfiles.htm- also batprogs.htm.
Nov 23 '06 #4
Dr J R Stockton wrote:
Anyone wanting to open a new *empty* window is very likely to want to
write to it (wRef.document.body.innerHTML=Str does that, for me).
Not "likely" in the case you offer, but "certain", as an empty window is
of strictly no use. However one would never use
wRef.document.body.innerHTML to write to an *empty* window! Rather, one
would employ the "javascript:" pseudo-protocol, or the simple
document.open(), document.write() and document.close() statements.
In general, where a number of questions are likely to occur together or
in succession, they can often better be answered together.
Agreed.
That may
mean that, while the enlarged entry is a replacement for the original
and should inherit its position in the FAQ, it may need a new Subject
line - "How do I open and use a new window with javascript?" maybe.
I don't know. The current entry, providing an excellent link, already
covers the difficult task of correctly opening a window. However, I fail
to see how the "use" that you propose differs from basic DOM
manipulations (unless you would like to later emphasize how the "opener"
property works, or how to move, raise, lower, resize... an existing
window - in which case you might have a point).
ISTM that the fiction that every FAQ Section 4 entry necessarily
corresponds exactly to a specific question once asked should be
abandoned - "Opening and using a new window with javascript?". Instead,
the quasi-questions should be adapted to fit the most useful answers.
It seems to me that this is already what the FAQ is doing, by splitting
entries into very small units, and providing links to external resources
(or FAQ notes if no satisfying resource is available) for further
analysis by the reader.

However, I suppose that only empirical analysis could stress the
validity of the current model, though it might simply demonstrate that
some FAQ entries are now outdated, and that some new ones might just
need to be added (along with appropriate links).
Kind regards,
Elegie.
Nov 24 '06 #5

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

Similar topics

4
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I POST a form to a new window? ----------------------------------------------------------------------- ...
4
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I modify the current browser window?...
1
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I open a new window with javascript?...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.