Can not use the location object is javascript
I was making a page with frames. One is a treeview frame, the other is showing a report. When I click the item in the left frame, the report will display in the right frame. But after I click the first item, the location object in the right frame became unavailable! Which prevents me from opening a new report in the same frame! Below is the main page code:
<iframe src ="demoFramesetLeftFrame.jsp" name="treeframe" id="treeframe" height="100%" width="200px" frameborder="0">
<iframe src="demoFramesetRightFrame.jsp" name="basefrm" id="basefrm" height="100%" width="" frameborder="0">
The basefrm is response for displaying the report. Does anyone know how t开发者_开发问答o solve this? Thanks a million!
It sounds like the navigation from the left frame is taking the right frame to a page on a different hostname. Then the right frame's window
properties including location
are inaccessible to code in the parent page due to the Same origin policy.
You can still navigate a frame without using its window's location
object. Just set the src
attribute on the iframe
object itself (in the parent document).
(Also consider not using frames for navigation like this. You'll be making your separate reports unbookmarkable.)
精彩评论