473,569 Members | 2,610 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 12289
On Tue, 31 Aug 2004 15:28:37 GMT, pow67 <po***@optonlin e.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.h tml" 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="JavaS cript">
<!--

function maximizeWin() {
if (window.screen) {
var aw = screen.availWid th;
var ah = screen.availHei ght;
window.moveTo(0 , 0);
window.resizeTo (aw, ah);
}
}

// -->
</SCRIPT>
<a href="myTestPag e.htm" target="_blank" onclick="maximi zeWin
()">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***@optonlin e.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="newWin dow(this.href,t his.target,
-1,-1,'yes','yes',0 ,0,'',false); return false;">click me</a>

HTH

Al.

function newWindow(sFile nameToView, sWindowName, iWidth, iHeight,
sCanScroll, bCanResize, iLeft, iTop, sExtraSettings, bReplaceHistory )
{
var oNewWin = null;
if (!sExtraSetting s) {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.availWi dth) ?
(screen.availWi dth - iWidth) / 2 : 0;
iTopPosition = (screen.availHe ight) ?
(screen.availHe ight - iHeight) / 2 : 0;
}

var sWindowSettings = 'height=' + iHeight + ',width=' + iWidth
+ ',top=' + iTopPosition + ',left=' + iLeftPosition + ',scrollbars=' +
sCanScroll + ',resizable=' + bCanResize + ',' + sExtraSettings;
oNewWin = window.open(sFi lenameToView, 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="javascrip t: void();" onclick="window .open('new_wind ow.htm',
'new_window','t oolbar=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="javas cript" type="text/javascript">
self-resizeTo(screen .width,screen.h eight);
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.cl ose()"> 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.c om> 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="javascrip t: void();" onclick="window .open('new_wind ow.htm',
'new_window','t oolbar=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,scro llbars'

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

<a href="new_windo w.html" target="new_win dow"
onclick="window .open(this.href ,this.target,'r esizable,scroll bars');return
false;" new window</a> 2) then, in the new_window.htm -- a wee bit of JS:

<head>
<script language="javas cript" 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.h eight);
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.cl ose()"> 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="javas cript" 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.h eight);
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*****@agrico reunited.com>
comp.lang.javas cript FAQ - http://jibbering.com/faq

Jul 23 '05 #9
Randy wrote:
1) <a href="javascrip t: void();" onclick="window .open('new_wind ow.htm',
'new_window','t oolbar=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="javas cript" type="text/javascript">
self-resizeTo(screen .width,screen.h eight);
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.h eight);
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.cl ose()"> 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
3406
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 found the following script on a freescripts page to do just that... it works perfectly. Into head section:
2
5351
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 gets called with a single arguement (full path to an image). The image is supposed to be downloaded to the cache, and when complete, a new window...
2
4381
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: Menu5_5_1=new Array("'Lonely Church","javascript:window.open ('http://www.photo.net/photodb/photo?photo_id=2640310')","",0,20,300); That works fine,...
7
7595
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 href only. I don't want to
8
8886
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. window.open('index.jsp',myform.target,'toolbar=no,menubar=no,resizable=yes,scrollbars=yes,width=800,height=600'); Any ideas? please help. thanks!!
6
5625
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 window when I open a new window. > > function expand() { > window.moveTo(0,0); > window.resizeTo(screen.availWidth, screen.availHeight); > }
29
4975
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 window properly but does not pass the parameter. (this is part of a coldfusion template) <a href="##"
6
8987
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 how to do this? Can I maximize window from current page after it is opened with window.open?
3
1855
dmjpro
by: dmjpro | last post by:
I am using this JavaScript code to open a window in a full screen mode .... var styles = "menubar=no,location=no,resizable=no,scrollbars=yes,status=no,left=0,top=0,width="+screen.width+",height="+screen.height; alert('Width: ' + screen.width + 'Height: ' + screen.height); var _win = window.open("welcome.jsp","opener_window",styles); Now...
0
7711
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...
0
7628
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...
0
8145
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...
1
7694
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7993
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5519
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...
0
5245
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3679
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...
0
3667
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.