Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
| Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 27th, 2005, 11:09 AM
Authorized User
 
Join Date: Jun 2003
Location: Jewett City, CT, USA.
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default Can I force a browser's window size

    I have a stand-alone Flash training application (within an HTML page) which is to be used within a classroom. When a student clicks on a shortcut on the desktop, I would like to force the browser window to open to the exact dimensions of the app. Can this be done?
    I know that I can use javascript to launch another window to the exact dimensions I want, but, then, I can't find a way to close the launching window without having an alert appear. I don't think it really makes sense to make the students close the first window.

Chris
 
Old May 27th, 2005, 03:09 PM
nzakas's Avatar
Wrox Author
 
Join Date: Dec 2004
Location: Peabody, MA, USA.
Posts: 217
Thanks: 0
Thanked 5 Times in 5 Posts
Default

You can't close the original window. For security reasons, you can only close windows that you opened using JavaScript. For all others, you'll get that confirmation window.

Nicholas C. Zakas
Author, Professional JavaScript for Web Developers (ISBN 0764579088)
http://www.nczonline.net/
 
Old May 27th, 2005, 03:13 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Chris,

You can use window.resizeTo to resize the window when it has loaded, e.g.:

<body onload="window.resizeTo(1024, 768);">

You can use document.body.scrollWidth and document.body.scrollHeight to get the width and height of the currently loaded document.

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.




Similar Threads
Thread Thread Starter Forum Replies Last Post
force popup window focus srcLakeJake Javascript 2 May 22nd, 2008 11:33 AM
Customizing the window size tenvuong BOOK: Ivor Horton's Beginning Visual C++ 2005 0 March 31st, 2008 09:16 AM
Window or Page size ckrajeshvarma ASP.NET 2.0 Professional 0 August 6th, 2006 12:53 AM
Window Size ckrajeshvarma ASP.NET 2.0 Basics 0 August 6th, 2006 12:50 AM
Disabling browser's window "X" button farhanzia Classic ASP Professional 1 July 9th, 2003 06:29 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.