Along with your script that opens the child window (the one where you set the scrollbars = yes or no), add a window-level variable that is true if the scrollbars = yes or false if not.
Then in your childβs script window you will see the value that was set from self.opener.myWindowLevelVariable .
You can also skip this variable. The important part is self.opener or window.opener, if you prefer.
Update:
In response to your update that you do not want to use the variable in the parent ... Then cancel my original sentence. Place the variable in the child when creating it.
Parent:
var scrollwindow = window.open("file.htm", "anotherwindow", "width=400,height=250,scrollbars=no"); scrollwindow.hasScrollbars = false;
Child:
alert(hasScrollbars);
If you want to handle the case when the child window opens directly, then it becomes more interesting ...
Child:
try {
Sniffing the scroll: I think this is what Stefano walked on. He was on the right track. But use clientWidth, scrollWidth, clientHeight and scrollHeight in combination. From quirks mode :
If the item does not have scrollbars scrollWidth / Height should be equal to clientWidth / height.
When an element has no scroll bars, IE makes scrollHeight equal to the actual height of the content; not the height of the element. scrollWidth is correct except for IE8, where its 5 pixels off.
So, you need to adjust the scroll part for IE a bit, but this is the main idea.
Daves source share