-2

I would like to use the code below but want it to happen to the current page when I click the link. Is this possible? Thanks in advance. :)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Open window to fullscreen without f11</title>
<script type="text/javascript">
function openWin(url){
var sw=screen.width;
var sh=screen.height;
newwin=window.open(url,'newwin','width='+sw+',height='+sh+',top=0,left=0,scrolling=0,toolbar=0,direc tories=0,menubar=0,location=0');
}
</script>
</head>

<body>
<a href="http://www.codingforums.com" onclick="openWin(this.href);return false;">Coding Forums</a>
</body>
</html>
Wladimir Palant
  • 56,865
  • 12
  • 98
  • 126
HAWKES08
  • 523
  • 1
  • 10
  • 23
  • Could you actually include the results of your tests in your questions? What happens if you try this code? What's the error message or what else is wrong? – Wladimir Palant Jun 22 '11 at 13:21
  • It is clear that the asker wants to load a new url fullscreen into current window. The code shown will attempt to fullscreen a NEW window (but won't) and Hawkes wants to try to do that with the main browser window – mplungjan Jun 22 '11 at 13:26
  • possible duplicate of [Full Screen Page by pressing button instead of F11.](http://stackoverflow.com/questions/6427690/full-screen-page-by-pressing-button-instead-of-f11) which is a duplicate of http://stackoverflow.com/questions/1125084/how-to-make-in-javascript-full-screen-windows-stretching-all-over-the-screen – mplungjan Jun 22 '11 at 13:28

2 Answers2

0

Have you tried using window.location.href instead of window.open? window.open is used to open new browser window.

Aziz Shaikh
  • 16,245
  • 11
  • 62
  • 79
0

No it is NOT possible to open a url and CHANGE THE CHROME in the same window and you should not try either.

There is a horrific hack which opens a new window and closes the parent, but that is even worse.

There USED to be a fullscreen parameter but it was luckily removed. It is not up to the web "designer" to decide the size of the user's window nor to try and remove their history by closing the main window.

If you search for fullscreen here, you will get many, among this one:

How to make the window full screen with Javascript (stretching all over the screen)

Community
  • 1
  • 1
mplungjan
  • 169,008
  • 28
  • 173
  • 236