Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

window.open problems with frameset

Status
Not open for further replies.

sparky212

Programmer
Feb 21, 2004
10
0
0
US
I have an interesting problem which seems to point toward a Javascript issue:

I'm using the Javascript "window.open" API to open a link in a new window. The linked page is a frameset with three frames: a single column on the left and column on the right which itself contains two frames. The top frame of the right column is supposed to extend down part-way down the page and then display another frame in the remainder of the column.(I can supply more detail on the frame orientation if necessary.)

Here's the interesting part: the right column frame does not display correctly from the window.open command. If loaded from a new browser window/entered into the address bar, everything displays perfectly. If I use the window.open command, the display is "off" (the bottom part of the right column is not "missing", but I have to scroll down to locate it -- which is not the correct display behavior).

More interesting: after executing the window.open command and showing the frameset display incorrectly, if I simply hit the "Maximize" button on the window -- everything magically fixes itself. I've tried all sorts of variations on "javascript maximize" (though note: I cannot easily modify code in the frameset source, I can only easily modify the window.open execution) -- with no luck. There is no true "window.maximize" function, and none of the substitute methods seem to exactly emulate the function of clicking the Window Maximize button. I cannot figure out the proper window.open call format to get the display to work properly, and I've tried a large number of variations.

This seems to be a very tricky one. Anyone out there have any experience with window.open/frameset issues?

Any help at all would be greatly appreciated.
 
Just for giggles, put this into the main page of your frameset:
Code:
<style>
BODY { overflow: hidden }
</style>
 
Supra --

Thanks for the reply!

I don't really have easy access to the loaded page with the framesets (that page "belongs" to someone else). For that reason, I'm trying to stick with changes to the Javascript (window.open) call alone.

While I honestly accept the possibility that code changes may be required on the frameset page, I find it odd that the page loads perfectly fine from within a new browser windows (calling the exact same URL) but renders incorrectly when loaded from the Javascript window.open call. As such (since the loaded frameset page works perfectly well in every other context), I want to stick with trying to solve the problem "from my end" first.

Any other ideas?

-- Mark
 
qwqwqwqwq --

Is that a modification I make in the calling page (to the window.open command) or is that change supposed to be made in the page with the framesets in it?

If you're asking me to make changes to the frameset page, please see my comment above to Supra. If I get the opportunity to change the frameset page, I will do so, but I'm not counting on it. Then again, even if I do get a chance to mod it, I'm hesitant as it's working perfectly in every other instance/browser.

-- Mark
 
sparky212; the suggestions I gave you are not good;

I was thinking of functions that may be helpful to use SOMEHOW; however my suggested implementation is not useful;

nevertheless, take a look at what each of those two functions do - location.replace() and window.resizeTo();

when you used window.open() did you use it like
Code:
<script language='javascript' type='text/javascript'>
var h = screen.availHeight;
var w = screen.availWidth;
window.open('[URL unfurl="true"]http://www.the_frameset_page.com'[/URL] , 'b' , "height=" + h + ", width=" + w );
</script>
?

Shannon Burnett
Asheville NC USA
 
'sounds like a quirky browser issue.

One of the things I would try would be to catch the window when I open it (e.g., var newWin = window.open(...);) and then refresh newWin right away (newWin.location = newWin.location.href;).

Since maximizing the window 'fixes' the look, perhaps refreshing the screen will too.

Good luck!

--Dave
 
All --

Thanks for all the suggestions and ideas.

I have made some progress at determining where the problem occurs. Here's some code, one function opens a full window (height and width) but doesn't show the frames correctly, and the second code sample has the "Height" variable removed, so it only opens up to the full width (not height), but the frames all show up correctly. (If I manually stretch the window down, everything "slides" correctly.) Here's the two code samples:

Doesn't work:

function winFuncBad(url, win_name) {
var newWin;
var winName='newWin'+getTimeStamp();
var str = "scrollbars=yes,toolbar=yes,resizable=yes,menubar=yes,location=yes,status=yes,left=0,screenX=0,top=0,screenY=0";
if (window.screen) {
var ah = screen.availHeight ;
var aw = screen.availWidth ;
str += ",innerHeight=" + ah;
str += ",innerWidth=" + aw;
str += ",height=" + ah;
str += ",width=" + aw;
}
apWin = window.open(url, winName, str);
apWin.focus();
}

Does work:

function winFuncGood(url, win_name) {
var newWin;
var winName='newWin'+getTimeStamp();
var str = "scrollbars=yes,toolbar=yes,resizable=yes,menubar=yes,location=yes,status=yes,left=0,screenX=0,top=0,screenY=0";
if (window.screen) {
var ah = screen.availHeight ;
var aw = screen.availWidth ;
str += ",innerHeight=" + ah;
str += ",innerWidth=" + aw;
//HEIGHT OPTION REMOVED
str += ",width=" + aw;
}
apWin = window.open(url, winName, str);
apWin.focus();
}

So...now...any new ideas? Thanks, really, for all the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top