Jump to content

Losing Frame Identity?


griffinmt
 Share

Recommended Posts

I am using AJAX inside of a page located inside a frame within the main window. Each frame was created with an object Name and ID, since from time to time these pages need to be reloaded (new content/subjects etc).In one frame, with the name "_body_", eventually gets loaded with a page containing an application that makes use of AJAX to update its data. The problem is that after doing this and then selecting another application to go into that frame, it launches in a brand new window instead. And all subsequent application get launced there.The outward symptom is that the Name/ID applied to the internal frame "_body_" has been altered somehow so that subsequent references cause the new window to be created. There is absolutely NO code in that new application that makes any attempt to monkey with the containing frame. Prior to this new application with AJAX, all other applications work as expected.I have even added code at the end of the new app to set the current window name and id to the needed value - no joy.Any clues or suggestions

Link to comment
Share on other sites

You possibly are loading a page that's on another domain and Javascript no longer has access to the content of the frame. Though, without more information, I can't give you a better answer.

Link to comment
Share on other sites

If all of the other applications work, and just this one doesn't, it sure sounds like that application does have code that looks for and breaks out of a frame.
I understand that conclusion, but it is a standalone app that makes synchronous ajax connections to retrieve data from a database and gets some results from a calculation. I wrote the entire thing, and the send only goes to a single point:
   xmlhttp.open('Post','http://localhost/Calc/addrecord.php',false);

Aside from the added "/Calc/addrecord.php", this is the same location that all the rest of the pages are served from.It is started from an index.htm page that contains the following:

document.write('<frameset rows="*" cols="112px,710px,*" frameborder="0" framespacing="0" >');document.write('<frame name="_menu_" src="xmenulist.htm" width="112px" frameborder="0" scrolling="no" framespacing="0"/>');document.write('<frameset rows="66px,1px,*" cols="710px" frameborder="0" framespacing="0" >');document.write('<frame name="_logo_" width="710px" src="xlogo.htm" frameborder="0" scrolling="no" framespacing="0" id="_logo_" />');document.write("<frame name='sliver' class='mainbody' frameborder='0' scrolling='no' framespacing='0'>\n");document.write('<frame class="mainbody" name="_body_" src="newindex.html" frameborder="0" scrolling="auto" id="_body_" />');document.write('</frameset>');document.write('<frame name="_faredge_" src="blueonly.htm" frameborder="0" scrolling="no" framespacing="0" id="_faredge_" />');document.write('</frameset>');document.write('</html>');

In addition, after the app loads the first time, it is working properly inside the correct frame.

Link to comment
Share on other sites

I misread your original post. What you're saying is that you have a page with a frameset on it, and you load various pages into a certain frame. After you load a certain page into it, all subsequent loads no longer load in the frame, but in a new window instead, is that correct? So the page in question does load into the correct frame, but after doing so all other loads open in a new window instead. I was assuming that this one page did not load into the frame, but every other page did.If what I describe sounds correct, I would recommend using Firebug to inspect the DOM after you load the page causing the problems. Look at the frame in the DOM before and after the load and try to identify if anything about it has changed. It will tell you what the current ID is and things like that when you inspect it in the DOM. If the frame has changed, then there must be some code in the other page that is changing those values. If that's the case, you can watch the frame object and set breakpoints in the code to identify the point at which the changes get made and figure out why that's happening.

Link to comment
Share on other sites

I misread your original post. What you're saying is that you have a page with a frameset on it, and you load various pages into a certain frame. After you load a certain page into it, all subsequent loads no longer load in the frame, but in a new window instead, is that correct? So the page in question does load into the correct frame, but after doing so all other loads open in a new window instead. I was assuming that this one page did not load into the frame, but every other page did.If what I describe sounds correct, I would recommend using Firebug to inspect the DOM after you load the page causing the problems. Look at the frame in the DOM before and after the load and try to identify if anything about it has changed. It will tell you what the current ID is and things like that when you inspect it in the DOM. If the frame has changed, then there must be some code in the other page that is changing those values. If that's the case, you can watch the frame object and set breakpoints in the code to identify the point at which the changes get made and figure out why that's happening.
I am not familiar with firebug, but will search it out. Suppose I could put some extra code in to 'trace' the id and name to see if it changes.Ok, I down loaded the addon for firefox and launched the website. Of course, I seldom ever use firefox and when I did, the application works without causing the problem!!!And if I was the only one to use it, I would just call it quits. But a number of folks will eventually use it and I cannot (not should) control which browser they use.So I still have the problem in IE 8 Edited by Martyn
Link to comment
Share on other sites

In IE8 go to Tools -> Developer Tools, find your frame in the source it shows and click on it, and on the right click the Attributes button. That will show you what the ID is, you can go through it and see if the ID or name changes.

Link to comment
Share on other sites

In IE8 go to Tools -> Developer Tools, find your frame in the source it shows and click on it, and on the right click the Attributes button. That will show you what the ID is, you can go through it and see if the ID or name changes.
Well, thanks for the concerns and help, but I found the cause by accident.I had a couple of javascript functions using the 'name' of name without any previous declaration with a var.As soon as I fixed that, all seems to work. Assume it was using the default window (that frame) and treating the name as one of its properties.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...