Forum Moderators: open

Message Too Old, No Replies

Why doesn't my var name.focus comand work!?

How do i open a new window onLoad and put it on top?

         

Baxter30

2:45 am on Nov 29, 2008 (gmt 0)

10+ Year Member



I am designing a simple program for my neice and nephew and would like to be able to open a window from the desk top into a fullscreen window. I have explored a number of ways to do this and none seem to work quite as effectively as I had hoped.
Attempt number one was useing a javascript statement to resize the window to fullscreen(true fullscreen without access to the address bar or any means of escape). It seems this command does not exist.

Attempt number two was to use an
onLoad="window.open('win.html','name','fullscreen')"
comand in conjunction with a self.close() command to open the new window and close the current. This proved slightly annoying because the window will prompt you because the it is trying to close itself.

Attempt number three and focus of my post is to use a js function to open the new window and focus and it instead of the current. It looks like this:

<html>
<head>
</head>

<script type="text/javascript" language="JavaScript">
<!--
function home() {
var index = window.open('indexh.html', 'index', 'fullscreen')
index.focus()
}
-->
</script>

<body bgcolor=black onLoad="home()">
</body>
</html>

Im new to webdesign and im sure there is some simple answer stareing me in the face.

Baxter

lokeshshettyk

2:02 pm on Dec 12, 2008 (gmt 0)

10+ Year Member



Try this

window.open('http://www.somedomain.com', '', 'fullscreen=yes, scrollbars=auto');

Cheers:)

Baxter30

5:01 am on Dec 16, 2008 (gmt 0)

10+ Year Member



Didn't work but thanks for taking a shot at it.

Greven

10:05 pm on Dec 18, 2008 (gmt 0)

10+ Year Member



If you can still use your second option, the below should work to close the window in IE6/7(not FF though)

<html>
<head>
<script>
function closeMe(){
window.open('','_self','');
this.focus();
window.opener = this;
self.close();
}
</script>
</head>
<body onload="javascript:closeMe()">
Close me!
</body>
</html>

Also, what browser are you using that


window.open(theURL, '', 'fullscreen=yes, scrollbars=auto');

doesn't work? I tried in FF3, IE 6/7 and all three worked

Baxter30

4:15 pm on Dec 19, 2008 (gmt 0)

10+ Year Member



Hey it worked nicely. Still prompted me to close window but the focus was immediatly shifted to the opened page upon load. THanks a lot man.