0

I am unable to resize a browser window using javascript in Firefox 7. This code works in all the browser so far I have checked. Does anyone know why it is not working in firefox 7.

In my example I am trying to resize a window which is opened as a result of clicking a link in a parent window. Thus, I have 2 files here.

index.html (parent)
Head section

<script type="text/javascript">

function openwin() {
    var win1 = window.open('index2.html','mywin','left=20,top=20,width=900,height=700,toolbar=1,resizable=0');
}

</script>

Body section -

<a href="javascript:openwin()">Click to open a new window</a>

index2.html (child)
Head section

<script type="text/javascript">

function fullscreen() {
    window.moveTo(0,0)
    window.resizeTo(screen.availWidth, screen.availHeight);
}

</script>

Body section -

 <a href="javascript:fullscreen()">Click to fullscreen a window</a>

Please let me know if any help. I assume there is a bug with FF7. Many thanks

Sparky
  • 98,165
  • 25
  • 199
  • 285
Ashwin
  • 12,081
  • 22
  • 83
  • 117
  • so, do you need it in a fullscreen or what? "In my example I am trying to resize a window which is opened" - resize how? where? full or specific value? – rmagnum2002 Oct 11 '11 at 15:19
  • see the code. Everything is in it. – Ashwin Oct 11 '11 at 15:28
  • well I put your code in html on my local, and I have this: I open the index1.html and there is a link for opening the index2.html, so I click, it is opening with the size set in javascript.. now I click on the full screen and it gets to ful screen. what is the problem. what you want to resize? it's working in firefox 7.0.1 – rmagnum2002 Oct 11 '11 at 15:34
  • Resize to any specific value. For eg. screen's height and width. – Ashwin Oct 11 '11 at 15:35
  • Then I am surprised that it works in FF7 ;). I checked on my and my colleague's machine. It didn't work. – Ashwin Oct 11 '11 at 15:36
  • yes, I changed the values for window in 100 / 100 and it's working – rmagnum2002 Oct 11 '11 at 15:37
  • Possibly the fault of linux version. I will check in windows version of FF7 tomorrow and will let u know. – Ashwin Oct 11 '11 at 15:37

2 Answers2

2

This is currently a bug in Firefox 7. It have been already reported to mozilla. More info available in the Bug report

Nettogrof
  • 2,116
  • 2
  • 15
  • 22
1

In FF6 you should use window.innerWidth or window.outerWidth and window.innerHeight or window.outerHeight to set window size, as shown here: http://www.java2s.com/Code/JavaScript/Window-Browser/SettingWindowHeightandWidthFirefox.htm

therealszaka
  • 453
  • 4
  • 20