473,396 Members | 1,784 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 1480
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: 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: 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...
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
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
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,...

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.