473,783 Members | 2,363 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need script to 'OpenWindow' or 'Spawn'

tmb
- Want to open a 2nd browser window when someone clinks a link with the link
content inside it.
- Want to control window size
- Want all tool bars so only blue bar at top shows
- Can I put my content in the blue bar?
- Only options are Minimize, Maximize or Close (top right of blue bar)

1 - What is the difference in 'OpenWindow' and 'Spawn' ??

2 - Can anyone point me to a simple script I can use... or just post one...

I Googled this and everything I find has so many strings attached and wants
me to 'join' something that it discourages me from geetting proceeding with
them.

I just want a simple script and a little coaching on how to implement this.

Can anybody please help me?

Thanks - tmb
Jul 23 '05 #1
2 2319
tmb wrote:
- Want to open a 2nd browser window when someone clinks a link with the link
content inside it.
- Want to control window size
- Want all tool bars so only blue bar at top shows
- Can I put my content in the blue bar?
- Only options are Minimize, Maximize or Close (top right of blue bar)
You can do all of the above (within limits of the user agent's abilities and
depending on whether some of the above features are excluded from what you can
achieve in a particular user agent) with the <attributes> parameter of the
window.open() method.

The only "content" you can put in the "blue bar" (more commonly called the
"titlebar", you _do_ know that it's not blue on many, many operating systems
don't you? and even on operating systems where it is blue, that can be changed
by the user) is the contents of the <title></title> tags on the new HTML page
opened in that window.
1 - What is the difference in 'OpenWindow' and 'Spawn' ??
Neither is a reserved word in Javascript, so they are probably just functions
written by Javascript authors. OpenWindow is presumably the name of some
function written by one Javascript author, Spawn is probably a function written
by another Javascript author. The difference between them would be the code
inside the functions.
2 - Can anyone point me to a simple script I can use... or just post one...
<script type="text/javascript">
function openWindow(lnk) {
if (window.open) {
return !window.open(ln k.href, lnk.target,
'width=400,heig ht=300,resizabl e=1');
}

return true;
}
</script>
<!-- example usage -->
<a href="page.html " target="myNewWi ndow"
onclick="return openWindow(this );">Test</a>

The attributes string (3rd parameter of window.open()) is documented at:

<url:
http://devedge.netscape.com/library/...ce/frames.html
/>

Internet Explorer supports a few more attributes (but don't use them unless
you're only supporting IE):

<url:
http://msdn.microsoft.com/workshop/a...ods/open_0.asp />
I just want a simple script and a little coaching on how to implement this.


The problem with a simple script is that you are going to be unaware of the
issues involved in opening a new window. The conventional wisdom is that on the
general public Internet, opening a new window is very often the wrong choice. Go
to groups.google.c om and search comp.lang.javas cript for "open new window" to
see past discussions on this subject.

The way my solution is written, if Javascript is enabled, the "onclick" event
will fire and open the new window with the HREF and TARGET attributes specified
by the <A> tag. If the opening of the new window _appears_ to succeed (important
point, _appears_ to succeed, it may, in fact, not have been successful), then
the link is not followed and processing stops.

If Javascript is not enabled, or the user agent does not support window.open, or
window.open() appears to fail, then the link _is_ followed and the page will
open in a new window anyway (thanks to the TARGET attribute and subject to the
capabilities of the user agent), you just won't be able to control the size and
chrome of the new window.

But even this is not 100% guaranteed to open a new window containing your
content under every circumstance, in every user agent.

Please be aware that many, if not all, Web browsers now offer some degree of
popup blocking (they disable the ability to open new windows). If they do allow
new windows to be opened, many Web browsers can control the attributes which can
be applied to those new windows (for example, a new window may open, but it may
not be the size, or have the chrome that you requested).

--
| Grant Wagner <gw*****@agrico reunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 23 '05 #2
tmb
Grant,

Just what I needed. Thanks.

tmb

"Grant Wagner" <gw*****@agrico reunited.com> wrote in message
news:40******** *******@agricor eunited.com...
tmb wrote:
- Want to open a 2nd browser window when someone clinks a link with the link content inside it.
- Want to control window size
- Want all tool bars so only blue bar at top shows
- Can I put my content in the blue bar?
- Only options are Minimize, Maximize or Close (top right of blue bar)
You can do all of the above (within limits of the user agent's abilities

and depending on whether some of the above features are excluded from what you can achieve in a particular user agent) with the <attributes> parameter of the
window.open() method.

The only "content" you can put in the "blue bar" (more commonly called the
"titlebar", you _do_ know that it's not blue on many, many operating systems don't you? and even on operating systems where it is blue, that can be changed by the user) is the contents of the <title></title> tags on the new HTML page opened in that window.
1 - What is the difference in 'OpenWindow' and 'Spawn' ??
Neither is a reserved word in Javascript, so they are probably just

functions written by Javascript authors. OpenWindow is presumably the name of some
function written by one Javascript author, Spawn is probably a function written by another Javascript author. The difference between them would be the code inside the functions.
2 - Can anyone point me to a simple script I can use... or just post
one...
<script type="text/javascript">
function openWindow(lnk) {
if (window.open) {
return !window.open(ln k.href, lnk.target,
'width=400,heig ht=300,resizabl e=1');
}

return true;
}
</script>
<!-- example usage -->
<a href="page.html " target="myNewWi ndow"
onclick="return openWindow(this );">Test</a>

The attributes string (3rd parameter of window.open()) is documented at:

<url:
http://devedge.netscape.com/library/...ce/frames.html />

Internet Explorer supports a few more attributes (but don't use them unless you're only supporting IE):

<url:
http://msdn.microsoft.com/workshop/a...ods/open_0.asp
/>
I just want a simple script and a little coaching on how to implement
this.
The problem with a simple script is that you are going to be unaware of the issues involved in opening a new window. The conventional wisdom is that on the general public Internet, opening a new window is very often the wrong choice. Go to groups.google.c om and search comp.lang.javas cript for "open new window" to see past discussions on this subject.

The way my solution is written, if Javascript is enabled, the "onclick" event will fire and open the new window with the HREF and TARGET attributes specified by the <A> tag. If the opening of the new window _appears_ to succeed (important point, _appears_ to succeed, it may, in fact, not have been successful), then the link is not followed and processing stops.

If Javascript is not enabled, or the user agent does not support window.open, or window.open() appears to fail, then the link _is_ followed and the page will open in a new window anyway (thanks to the TARGET attribute and subject to the capabilities of the user agent), you just won't be able to control the size and chrome of the new window.

But even this is not 100% guaranteed to open a new window containing your
content under every circumstance, in every user agent.

Please be aware that many, if not all, Web browsers now offer some degree of popup blocking (they disable the ability to open new windows). If they do allow new windows to be opened, many Web browsers can control the attributes which can be applied to those new windows (for example, a new window may open, but it may not be the size, or have the chrome that you requested).

--
| Grant Wagner <gw*****@agrico reunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html
* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp
* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html

Jul 23 '05 #3

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

Similar topics

0
4073
by: Kevin Cheramie | last post by:
I'm unsure how to break down and use what is returned by expect in the rest of my script. I want to issue a command and split the results of that command into several different variables. I then want to use those variables in the rest of my script. Here is a snipet: $expcxn = Expect->spawn("telnet 10.10.10.10\r") or die "Cannot spawn telnet: $!\n\n"; $expcxn->expect($timeout, "assword:") or die "Did not get a password prompt: $!/n/n";...
1
1826
by: Krechting | last post by:
Hi All, I need a button on my form that opens a new window. I put in a submit button but it always returns to my first page. And then my first page is empty. What button do I need to go to another page (weapon_related)? This is what I use at the moment: 'NewRecord1 Operation Method @3-0C905987
3
5197
by: Steve | last post by:
Hi, I have a nice little script that works well displaying images on my website. It's a script where if you clik a thumbnail image a pop up window opens that contains a larger version of the same image. What I would like to create is a link that can be clicked on to close the window that contains the larger image. This would make it easier for the users to close the window. I have posted the script that I use. Any help would be much...
0
1522
by: Krutibas Biswal | last post by:
Hi, I am using a script 'unbuffer' for unbuffering my outputs when using pipes. This script is based on expect and looks like this : ---------------------------------------------- #!/usr/bin/expect -- # Description: unbuffer stdout of a program # Author: Don Libes, NIST eval spawn -noecho $argv
4
3467
by: Jani Yusef | last post by:
I want to create a tree of processes. The depth of the tree is given by the variable depth and the number of processes started by each node is given by the variable numberOfProcesses. Is the following code correct? I don't think it is, especially since I don't want the bottom nodes(leaf nodes) to start any processes themselves. Any comments on the following code would be much appreciated!! for(j=0;j<depth;j++){...
2
7719
by: vmalhotra | last post by:
Hi I am new in python scripting. I want to open a Multiple telnet session through once script. In other way i can tell i want to open two linux consoles through one script. I wrote one script, but the issue is I am not able to open multiple consoles. The Scripts which i wrote is as follows: import pexpect
3
2426
by: sophie_newbie | last post by:
Hi, I have a cgi script that performs a very long computation that can take several hours to complete. Is there any smart way that I can keep this script running until it is finished (after the user has closed the browser) and email them with the results. The email bit isn't the problem, I just don't know how to keep the code running in the background. I'm sure there is a smart way to do this... Thanks!
1
1596
by: sophie_newbie | last post by:
I've posted something similar to this already, but now I'm more sure of what I'm asking. Basically I've a CGI script, that when executed by the user, I want to call another script that does a very long running task (10 hours +) and print a message on the screen saying that the user will be emailed on completion of the very long task. The script executing the very long task will then email the user on completion. So far I have...
3
12069
by: bollweevil | last post by:
Hello Everyone, I do Django web development on my Mac at home, and then I rsync the files with the Ubuntu web server. I want to write one single bash shell script that rsyncs the files and restarts Apache on the server. Here is the script I have so far, sync.sh: #!/bin/bash echo -n Password: read -s PW rsync --compress --times --perms --links --recursive --delete --include-from=incls.txt --exclude "*" /User/bollweevil/django-site/*...
0
9643
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10313
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8968
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2875
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.