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

new window full screen

Is there a javascript statement which can be incorporated in a
hyperlink which will open a new page that fills the screen while
leaving the page with the link open?

Thanks in advance.
CW
Jul 23 '05 #1
9 12264
On Tue, 31 Aug 2004 15:28:37 GMT, pow67 <po***@optonline.net> wrote:
Is there a javascript statement which can be incorporated in a
hyperlink which will open a new page that fills the screen while
leaving the page with the link open?

Thanks in advance.
CW


<a href="newfile.html" target="newwin"
onclick="window.open(this.href, this.target, 'fullscreen'); return
false">Click me</a>
Note: fullscreen is IE only.

HTH

Al.
Jul 23 '05 #2
Thanks.
The script below works in IE but not Netscape- Any ideas?
<SCRIPT LANGUAGE="JavaScript">
<!--

function maximizeWin() {
if (window.screen) {
var aw = screen.availWidth;
var ah = screen.availHeight;
window.moveTo(0, 0);
window.resizeTo(aw, ah);
}
}

// -->
</SCRIPT>
<a href="myTestPage.htm" target="_blank" onclick="maximizeWin
()">Click Here</a></p>
Jul 23 '05 #3
Correction. The script in previous message works in Netscape but not IE.

Thanks in advance.

CW
Jul 23 '05 #4
On Tue, 31 Aug 2004 18:44:55 GMT, pow67 <po***@optonline.net> wrote:
Correction. The script in previous message works in Netscape but not IE.

Thanks in advance.

CW


I use the below script for NS7 & IE6.

<a href="filename.asp" target="newwin"
onclick="newWindow(this.href,this.target,
-1,-1,'yes','yes',0,0,'',false); return false;">click me</a>

HTH

Al.

function newWindow(sFilenameToView, sWindowName, iWidth, iHeight,
sCanScroll, bCanResize, iLeft, iTop, sExtraSettings, bReplaceHistory)
{
var oNewWin = null;
if (!sExtraSettings) {sExtraSettings='';}
// iWidth/iHeight=-1 for netscape to go "near as damit" full
screen
// NS user needs to press F11 to go true full screen.
if (iWidth == -1 || iHeight == -1) {
sExtraSettings =
sExtraSettings.replace(/fullscreen/gi, '');
if (sExtraSettings) {sExtraSettings += ',';}
sExtraSettings += 'fullscreen, outerWidth=' +
screen.width + ', outerHeight=' + screen.height;
iLeft = 0;
iTop = 0;
}
var iLeftPosition = iLeft;
var iTopPosition = iTop;
// iLeft/iTop=-1 centers the newwindow on the screen
if (iLeft == -1 || iTop == -1) {
iLeftPosition = (screen.availWidth) ?
(screen.availWidth - iWidth) / 2 : 0;
iTopPosition = (screen.availHeight) ?
(screen.availHeight - iHeight) / 2 : 0;
}

var sWindowSettings = 'height=' + iHeight + ',width=' + iWidth
+ ',top=' + iTopPosition + ',left=' + iLeftPosition + ',scrollbars=' +
sCanScroll + ',resizable=' + bCanResize + ',' + sExtraSettings;
oNewWin = window.open(sFilenameToView, sWindowName,
sWindowSettings, bReplaceHistory);
oNewWin.focus();
return oNewWin;
}

Jul 23 '05 #5
pow67 wrote:
Is there a javascript statement which can be incorporated in a
hyperlink which will open a new page that fills the screen while
leaving the page with the link open?
Yes, however it uses a feature of the DOM, not the core
language and so it is likely not to work in all UAs:

<a href="foo.html"
onclick="window.open(this.href, ..., "fullscreen"); return false;"...</a>


Note that fullscreen, if it works, may result in undesired presentation.
Use Google Groups for details.
PointedEars
--
completely foolproof was to underestimate the ingenuity of complete fools.
Jul 23 '05 #6
1) <a href="javascript: void();" onclick="window.open('new_window.htm',
'new_window','toolbar=no, status=no, menubar=no, resizeable=no')" > new
widow </a>

2) then, in the new_window.htm -- a wee bit of JS:

<head>
<script language="javascript" type="text/javascript">
self-resizeTo(screen.width,screen.height);
self-moveTo(0,0);
</script>
</head>

3) to provide the new window with an easy way out (other than the 'X' Close
in the upper right) provide for the use a <<back or <<home>> link (which
actually just closes the window, allowing the initial window to re-appear);
otherwise, you've got just another annoying pop-up:

<a href="window.close()"> back </a>

4) make sure all your JS is in a single line: breaks, returns and <br> can
cause JS errors
Randy.
Jul 23 '05 #7
On Thu, 9 Sep 2004 23:26:32 -0600, Randy <RP****@yahoo.com> wrote:

Sorry to berate you, but there are obvious errors here that you should
have found had you tested what you posted.
1) <a href="javascript: void();" onclick="window.open('new_window.htm',
'new_window','toolbar=no, status=no, menubar=no, resizeable=no')" > new
widow </a>
The feature string cannot contain spaces. It's also a bad idea to prevent
resizing (which you spelt incorrectly). Replace it with:

'resizable,scrollbars'

You should also avoid javascript URIs unless you have a *good* reason to
use them.

<a href="new_window.html" target="new_window"
onclick="window.open(this.href,this.target,'resiza ble,scrollbars');return
false;" new window</a> 2) then, in the new_window.htm -- a wee bit of JS:

<head>
<script language="javascript" type="text/javascript">
The language attribute is deprecated and shouldn't be used. The presence
of the type attribute also makes it unnecessary.
self-resizeTo(screen.width,screen.height);
self-moveTo(0,0);
That will cause an error, greatly annoy large or multi-monitor users, and
fail to work at all (assuming the dashes were dots) in all my browsers
except IE (which I only use to test, anyway).

[snip]
otherwise, you've got just another annoying pop-up:
All pop-ups are annoying, whether a close button is present or not.
<a href="window.close()"> back </a>


You certainly didn't test that.

[snip]

Please read the group FAQ (<URL:http://jibbering.com/faq/>), and test what
you post.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #8
Michael Winter wrote:
2) then, in the new_window.htm -- a wee bit of JS:

<head>
<script language="javascript" type="text/javascript">


The language attribute is deprecated and shouldn't be used. The presence
of the type attribute also makes it unnecessary.
self-resizeTo(screen.width,screen.height);
self-moveTo(0,0);


That will cause an error, greatly annoy large or multi-monitor users, and
fail to work at all (assuming the dashes were dots) in all my browsers
except IE (which I only use to test, anyway).


Even if it were written correctly, it still won't do anything in my browser,
where resizeTo() and moveTo() have no effect at all. Well, they have an
effect, when I realize the site author is trying to control the size and
position of my browser window, I chuckle a bit at my victory over their lame
attempt to enforce their will upon me.

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq

Jul 23 '05 #9
Randy wrote:
1) <a href="javascript: void();" onclick="window.open('new_window.htm',
'new_window','toolbar=no, status=no, menubar=no, resizeable=no')" > new
widow </a>
This is utter nonsense.

1. URIs must not contain whitespace, the ":" within the "href"
attribute value should not be followed by a space character.

2. "void" is a special operator, not a method; it requires an
operand that "()" does not provide. As the "click" event
is not canceled, this URI will cause a script error.

3. This link will not work if client-side scripting is absent;
either an error message from the UA will occur or just nothing
will happen.

4. The third argument of window.open() must not contain spaces,
so the features of the new window will not be applied here.
2) then, in the new_window.htm -- a wee bit of JS:

<head>
<script language="javascript" type="text/javascript">
self-resizeTo(screen.width,screen.height);
self-moveTo(0,0);
</script>
</head>
More nonsense.

1. Valid HTML requires a "title" element as child of the "head element.

2. The "language" attribute is deprecated. Using the required "type"
attribute value removes the need for using the former.

3. Object reference and method identifier are to be separated by the lookup
operator ".", not the substraction operator "-". Here, a substraction of
an object reference (self) by the *result* of the resizeTo() method will
be performed, resulting in a NaN (not a number) value that is discarded.
It only works because in many UAs, "self" is a reference to the current
Window object, which is also the global object;

resizeTo(screen.width,screen.height);
moveTo(0,0);

would also work and would avoid the useless operation.

4. Display resolution != desktop size != browser window size
!= viewport size. [psf 3.7]

5. Recent browsers allow these particular features of client-side
scripting to be disabled.
3) to provide the new window with an easy way out (other than the 'X'
Close in the upper right) provide for the use a <<back or <<home>> link
(which actually just closes the window, allowing the initial window to
re-appear); otherwise, you've got just another annoying pop-up:

<a href="window.close()"> back </a>
Nonsense. This link will do nothing, since there is not recource with
that URL (and can't be, see RFC 2396). The "href" attribute value must be
prefixed with "javascript:" or, even better, the "onclick" handler should
be used and the link should be written dynamically using DOM methods.
4) make sure all your JS is in a single line: breaks, returns and <br>
can cause JS errors


Nonsense. Understanding how automatic semicolon insertion works in
ECMAScript implementations and, even better, not to rely on it, helps to
understand why some code works and another does not. Basic knowledge on
how to use the debugging features of an UA also helps to find such errors.
Generally, there are no known errors to be caused by whitespace of any
kind within script code, which is in accordance to both the HTML 4.01 and
the ECMAScript Specification. Only in XHTML an attribute value should not
span several lines, so it is best to put script code in a single line if
it is used in an intrinsic event handler's attribute value; however,
maintenance efforts of complex statements usually decrease if they are
moved into a method and this method is called instead; this often removes
the need for several lines of code within the attribute value.

Please RTFM before posting more of such nonsense, thanks.
PointedEars
--
Don't throw houses when you live in a glass stone.
Jul 23 '05 #10

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

Similar topics

10
by: -DRB- | last post by:
Hi all, I'm very much an amateur designing a page (for free!) for a friend, so any help offered would be hugely appreciated. I'm aiming to open a maximised window (and isn't that fun...) and...
2
by: Randell D. | last post by:
HELP! Its taken me ages - I'm a newbie and I've compiled bits of code that I've read in this newsgroup over time to create one of my most intricate functions to date... Basically, the script...
2
by: Larry R Harrison Jr | last post by:
I have pull-down menus in javascript and I have the code for opening a link in a new window. But I want it to open a full-sized window. I can't figure out the syntax. What I have so far: ...
7
by: Mark | last post by:
Hello; Here is what I wish to do: Click on a PDF link and have it open as a full screen window - not as a predetermined size. Sounds simple? I want to run the command from within the...
8
by: jrefactors | last post by:
I want to maximize the browser window when I open a new window. Now I do the following, but different monitor size will yield different width and height values. ...
6
by: David Hayes | last post by:
juglesh <juglesh@nospamRadioKDUG.com> wrote in "Re: how to maximize the browser window that fits the monitor size?" (Saturday, January 01, 2005 3:12 AM): > > >I want to maximize the browser...
29
by: wayne | last post by:
Hey there... I'm having some problems passing url parameters with an open.window command. I'm not terribly familiar with java script but here is the code below. When executed it opens the...
6
by: Mateo | last post by:
Hi! I tried to open page in new window with window.open(...) method. open() method supports fullscreeen mode, but I would like to open new maximized window with tiltle bar only.... Any idea...
3
dmjpro
by: dmjpro | last post by:
I am using this JavaScript code to open a window in a full screen mode .... var styles =...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: 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...
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,...

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.