PDA

View Full Version : automatic follow through to Full Screen window



Hilholland
10-17-2008, 06:25 PM
I have a question... and maybe you can help:

To go to a full screen I am using the following script


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Full Screen PopUp window</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="javascript" type="text/javascript">
<!--

winWidth = 1024; // sets a default width for browsers who do not understand screen.width below
winheight = 768; // ditto for height

if (screen){ // weeds out older browsers who do not understand screen.width/screen.height
winWidth = screen.width;
winHeight = screen.height;
}

// this function calls a popupWindow where
// win is the page address i.e. '../page.htm'

function popupWindow(win){

newWindow = window.open(win,'newWin','fullscreen=yes,titlebar=no,toolbar=no,location=no,addressbar=no, statusbar= no, scrollbars=yes, resizable= no,width='+winWidth+',height='+winHeight+',left=0,top=0');
newWindow.focus();
}
// -->

</script>
</head>

<body>
<a href="javascript:popupWindow('myUrl.html')">Click Here</a>
</body>
</html>

My question is:

is it possible to not need the viewer of the website to click on "Click Here", but to make the browser go through to the full screen display of myUrl.html automaticly?

I thought of using
window.location.replace("myUrl.html), but can't get it to work.


Or even better....:

is it not possible to have myUrl.html load itself at full screen? Not needing any other window. This would be much better still. If possible..., how?


Eddy

zaphod42
10-18-2008, 01:22 AM
window.location.href=(urlVariable)
or
window.location.href=('http://myUrl.dom')

automatically from the second they log on to the page? That would pretty much be a onLoad event in the body tag to call the window function


function openUrl(){
window.location.href=('http://myUrl.dom')
window.resizeTo(screen.availWidth,screen.availHeight);
window.moveTo(0,0)
}

Hilholland
10-18-2008, 09:35 AM
zaphod42,

thanks for your reply.
I am having difficulty getting it to work. How do i place this code within my code?

zaphod42
10-18-2008, 10:04 PM
replace that whole javascript in your script tag with the openUrl function, and replace the url currently in the function with the one you would like to open....in your body tag you can do a


<body onLoad="openUrl()">

you could also send in an argument to the function that can act as the url:


function openUrl(url){
window.location.href=(url)
window.resizeTo(screen.availWidth,screen.availHeight);
window.moveTo(0,0)
}

then your body tag would look like this:


<body onLoad="openUrl('http://whatever.url')">

if you change the function call in your old code to reference this function it will still work:


<a href="javascript:popupWindow('myUrl.html')">Click Here</a>
becomes

<a href="javascript:openUrl('myUrl.html')">Click Here</a>

you could also send in a second argument to define if you want to open the new link in the current window or in a new one:


function openUrl(url,newWindow){
if(!newWindow){
window.location.href=(url)
window.resizeTo(screen.availWidth,screen.availHeight);
window.moveTo(0,0)
}else{
newWindow = window.open(win,'newWin','fullscreen=yes,titlebar=no,toolbar=no,location=no,addressbar=no, statusbar= no, scrollbars=yes, resizable= no,left=0,top=0');
newWindow.focus();
}
}

now when you call the function you can send in a second argument to tell it to open in a new window:


openUrl('http://myUrl.com',true)

will now open your popup window

Hilholland
10-18-2008, 11:45 PM
zaphod42,

thanks so much for your help.
the following code works like i want it to, opening the window in the same window:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Full Screen PopUp window</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="javascript" type="text/javascript">
<!--
function openUrl(url){
window.location.href=(url)
window.resizeTo(screen.availWidth,screen.availHeight);
window.moveTo(0,0)
}
</script>
</head>

<body onLoad="openUrl('http:myUrl')">
</body>
</html>


Only thing is that I would like to add this following code to it


'titlebar=no,toolbar=no,location=no,addressbar=no, statusbar= no, scrollbars=no, resizable= no

Where and how? Still opening in the same window.

Also, do you know a way to keep a window out of the browsers history list (last visited windows)? This so that a visiter can never bypass and go straight to "http:MyUrl". Like, what keeps the page (that where putting the above code into) out of the history list?

zaphod42
10-19-2008, 02:14 AM
the history is controlled by a property called window.history I believe, I haven't played with it a whole lot, I'll look into it a bit, as for the scrollbars and such....I don't know that you can set those properties on a window that is already open, and you can't close and reopen the window, because you aren't allowed to close windows that aren't opened by the script....so to take away all the extras, you'll have to open a new window

Hilholland
10-19-2008, 08:30 AM
I am using a window that goes before this window that has the script:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>VAN SCHAYK V.O.F.**|**Financieel Administratieve Dienstverlening</title>
<script language="JavaScript1.2">
<!--

/*
Screen Size Redirect script (By Robert @ http://members.tripod.com/technological_tinker/)
Submitted to Dynamicdrive.com to feature script in archive
For full source, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
*/


if (screen.width==800||screen.height==600) //if 800x600
window.location.replace("http://myUrl1")

else if (screen.width==1024||screen.height==768) //if 640x480
window.location.replace("http://myUrl1")

else //if all else
window.location.replace("http://myUrl2")

//-->
</script>
</head>

<body>
</body>
</html>

So this doesn't give me a possibility to add
'titlebar=no,toolbar=no,location=no,addressbar=no, statusbar= no, scrollbars=no, resizable= no either? I geuss not, seeing that this also doesn't open a new window.

zaphod42
10-19-2008, 09:02 AM
nope, in that instance you are just altering the current window also, so it wasn't opened by the script, and so some of the properties are not available to alter....again this is as far as I can tell....also, the history object seems to have limited functionality.....there are security measures that are in place, for good reason, to keep people from doing certain things;)

Hilholland
10-19-2008, 09:31 AM
thank you for being so generous with your knowledge.
Is it then possible if i open a new window to automaticly close the old window that is opening the new window?

Hilholland
10-19-2008, 09:48 AM
you could also send in a second argument to define if you want to open the new link in the current window or in a new one:


function openUrl(url,newWindow){
if(!newWindow){
window.location.href=(url)
window.resizeTo(screen.availWidth,screen.availHeight);
window.moveTo(0,0)
}else{
newWindow = window.open(win,'newWin','fullscreen=yes,titlebar=no,toolbar=no,location=no,addressbar=no, statusbar= no, scrollbars=yes, resizable= no,left=0,top=0');
newWindow.focus();
}
}

now when you call the function you can send in a second argument to tell it to open in a new window:


openUrl('http://myUrl.com',true)

will now open your popup window


I am trying to apply this, but it is not working because, without a doubt, I am not getting it.

Could you help please? Don't want a choice between same or new window, just want the new window now, and hopefully close the old window at the same time.
Sorry for being such a dummy.

zaphod42
10-19-2008, 09:53 AM
no, because once again the old window is NOT opened by the script, and so closing it is a security issue

Hilholland
10-19-2008, 10:03 AM
Did you see this?

Quote:
Originally Posted by zaphod42
you could also send in a second argument to define if you want to open the new link in the current window or in a new one:

Code:
function openUrl(url,newWindow){
if(!newWindow){
window.location.href=(url)
window.resizeTo(screen.availWidth,screen.availHeight);
window.moveTo(0,0)
}else{
newWindow = window.open(win,'newWin','fullscreen=yes,titlebar=no,toolbar=no,location=no,addressbar=no, statusbar= no, scrollbars=yes, resizable= no,left=0,top=0');
newWindow.focus();
}
}
now when you call the function you can send in a second argument to tell it to open in a new window:

Code:
openUrl('http://myUrl.com',true)
will now open your popup window

I am trying to apply this, but it is not working because, without a doubt, I am not getting it.

Could you help please? Don't want a choice between same or new window, just want the new window now, with

titlebar=no,toolbar=no,location=no,addressbar=no, statusbar= no, scrollbars=yes, resizable= no

zaphod42
10-19-2008, 02:33 PM
function openUrl(url,newWindow){
if(!newWindow){
window.location.href=(url)
window.resizeTo(screen.availWidth,screen.availHeight);
window.moveTo(0,0)
}else{
newWindow = window.open(win,'newWin','fullscreen=yes,titlebar=no,toolbar=no,location=no,addressbar=no, statusbar= no, scrollbars=yes, resizable= no,left=0,top=0');
newWindow.focus();
}
}

should be



function openUrl(url){
newWindow = window.open(url,'newWin','fullscreen=yes,titlebar=no,toolbar=no,location=no,addressbar=no, statusbar= no, scrollbars=yes, resizable= no,left=0,top=0');
newWindow.focus();
}

Hilholland
10-19-2008, 05:16 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Full Screen window</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="javascript" type="text/javascript">
<!--
function openUrl(url){
newWindow = window.open(url,'newWin','fullscreen=yes,titlebar=no,toolbar=no,location=no,addressbar=no, statusbar= no, scrollbars=yes, resizable=no,left=0,top=0');
newWindow.focus();
}
</script>
</head>

<body onLoad="openUrl('http://myUrl')">
</body>
</html>

Above code is as I have it now.

This opens a new window on my Mac using Safari browser,but not at full screen. It does not open a new window on my WindowsPC using IE.

uhmmmmm. ??

zaphod42
10-19-2008, 06:44 PM
safari doesn't support the full screen property....ie is really obnoxious without a titlebar, so let's change this:


function openUrl(url){
newWindow = window.open(url,'newWin',"fullscreen=yes,titlebar=no,toolbar=no,addressbar=no,statusbar=no,scrollbars=yes,resizable=no");
newWindow.focus();
}

to this:)


function openUrl(url){
newWindow = window.open(url,'newWin',"fullscreen=yes,titlebar=no,toolbar=no,addressbar=no,statusbar=no,scrollbars=yes,resizable=no");
window.resizeTo(screen.availWidth,screen.availHeight);
window.moveTo(0,0)
newWindow.focus();
}

I don't have safari running right now, but it works in ff3 and ie 6 for sure:)

check this link out
Quirksmode JS Popups (window.open) (http://www.quirksmode.org/js/popup.html)

Hilholland
10-19-2008, 08:11 PM
On a Mac with Safari; what happens now is that not the window with myUrl ends up at Full Screen and Moved to (0,0) , but the window that we are putting this code into. I would like the newWindow to be full screen.

On a windowsPC running IE (recently updated): only the window that we are putting this code into shows and is Moved to (0,0), but not at full screen. The newWindow is not showing at all.

I am simply copying and pasting your code ofcourse.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Full Screen window</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="javascript" type="text/javascript">
<!--
function openUrl(url){
newWindow = window.open(url,'newWin',"fullscreen=yes,titlebar=no,toolbar=no,addressbar=no,statusbar=no,scrollbars=yes,resizable=no");
window.resizeTo(screen.availWidth,screen.availHeight);
window.moveTo(0,0)
newWindow.focus();
}
</script>
</head>

<body onLoad="openUrl('http://myUrl')">
</body>
</html>

Hilholland
10-19-2008, 08:35 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Full Screen PopUp window</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="javascript" type="text/javascript">
<!--

winWidth = 1024; // sets a default width for browsers who do not understand screen.width below
winheight = 768; // ditto for height

if (screen){ // weeds out older browsers who do not understand screen.width/screen.height
winWidth = screen.width;
winHeight = screen.height;
}

// this function calls a popupWindow where
// win is the page address i.e. '../page.htm'

function popupWindow(win){

newWindow = window.open(win,'newWin','fullscreen=yes,titlebar=no,toolbar=no,location=no,addressbar=no, statusbar= no, scrollbars=no, resizable= no,width='+winWidth+',height='+winHeight+',left=0,top=0');
newWindow.focus();
}
// -->
</script>
</head>

<body>
<body onLoad="javascript:popupWindow('http://myUrl')">
</body>
</html>

If I use the above code all works well on a MAC, but on a WindowsPC still no show of a new window.

(?????)

Hilholland
10-19-2008, 08:41 PM
could you please check:

weblink (http://www.vanschaykvof.nl/starter)

and see what happens at your end. You should end up at the homepage of "van Schayk vof",named "index2" (with picture of girl). This "index2" should be in a new window.
It's not happening for me on winPC, but is all fine on mac.

This is using:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Full Screen PopUp window</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="javascript" type="text/javascript">
<!--

winWidth = 1024; // sets a default width for browsers who do not understand screen.width below
winheight = 768; // ditto for height

if (screen){ // weeds out older browsers who do not understand screen.width/screen.height
winWidth = screen.width;
winHeight = screen.height;
}

// this function calls a popupWindow where
// win is the page address i.e. '../page.htm'

function popupWindow(win){

newWindow = window.open(win,'newWin','fullscreen=yes,titlebar=no,toolbar=no,location=no,addressbar=no, statusbar= no, scrollbars=no, resizable= no,width='+winWidth+',height='+winHeight+',left=0,top=0');
newWindow.focus();
}
// -->
</script>
</head>

<body>
<body onLoad="javascript:popupWindow('http://myUrl.html')">
</body>
</html>

When using:


<body>
<p><a href="javascript:popupWindow('http://MyUrl')">Click here</a></p>
</body>

you can click your way to the homepage, on a Mac and also a WinPc. Is this another security issue that stops a WinPC from automaticly loading a new window?

zaphod42
10-19-2008, 08:57 PM
oops:


window.resizeTo(screen.availWidth,screen.availHeight);
window.moveTo(0,0)

should have been


newWindow.resizeTo(screen.availWidth,screen.availHeight);
newWindow.moveTo(0,0)

Hilholland
10-19-2008, 09:01 PM
thanks.

before making change online, I will await your reply to the above.

zaphod42
10-19-2008, 09:38 PM
this is wrong first of all...


winWidth = 1024; // sets a default width for browsers who do not understand screen.width below
winheight = 768; // ditto for height

keep in mind that the reason I had it like it was earlier, is that the script you use to define the sizes is outdated....screen.availWidth and Height are valid cross browser compatible properties...

Also, what are you using to view? it works for me in ff3....ie throws an error, but if you replace


width='+winWidth+',height='+winHeight+'


with


width='+screen.availWidth+',height='+screen.availHeight+'

it seems to fix the problem

Hilholland
10-19-2008, 10:56 PM
It seems that using

body>
<p><a href="javascript:popupWindow('http://myUrl')">click here</a></p>
</body>
gets the visitor past the popup blocker in IE

when using


<body onLoad="openUrl('http://myUrl')">
</body>
the popup blocker of IE blocks the newWindow. And this was the problem.

Is there a solution for this?

zaphod42
10-19-2008, 11:20 PM
prolly not since it is a popup blocker;)

Hilholland
10-19-2008, 11:22 PM
thank you so very much for all your help.