472,962 Members | 2,413 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,962 software developers and data experts.

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 2273
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(lnk.href, lnk.target,
'width=400,height=300,resizable=1');
}

return true;
}
</script>
<!-- example usage -->
<a href="page.html" target="myNewWindow"
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.com and search comp.lang.javascript 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*****@agricoreunited.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*****@agricoreunited.com> wrote in message
news:40***************@agricoreunited.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(lnk.href, lnk.target,
'width=400,height=300,resizable=1');
}

return true;
}
</script>
<!-- example usage -->
<a href="page.html" target="myNewWindow"
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.com and search comp.lang.javascript 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*****@agricoreunited.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
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...
1
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...
3
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...
0
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 : ----------------------------------------------...
4
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...
2
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...
3
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...
1
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...
3
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...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.