How to get url info from body frame
Hi
My frame page is as follow
<html>
<frameset rows="50%,50%">
<frame src="frame1.html" name="frameName1">
<frame src="frame2.html" name="frameName2">
</frameset>
</html>
How do I get the top location url from frameName2? I tried to use javascript, it show me an error that "Permission Denied". Is there anyway to solve this problem?
Is there anyway to get the referer page in frameNAme2? Thanks for reading and replying my post.
[544 byte] By [
comp_jb] at [2007-11-11 8:03:04]

# 1 Re: How to get url info from body frame
In Internet Explorer, from the second frame you would reference the first frame's URL this way:
parent.frames['frameName1'].location
I'm afraid I don't know how to get the referer, but it can probably be done.
# 2 Re: How to get url info from body frame
Comp,
Java Script Source has several cut and paste scripts that work great for frame navigation. This one is similar to the one already posted - I got it from Java Script Source and adapted it to use with IFrames. The first part goes in the head. The links are outside of the IFrame.
<SCRIPT LANGUAGE="JavaScript">
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
function frameNavig() {
frames['record'].window.location="page.html";
}
function frameNavig1() {
frames['record'].window.location="page1.html";
}
function frameNavig2() {
frames['record'].window.location="page2.html";
}
function frameNavig3() {
frames['record'].window.location="page3.html";
}
function frameNavig4() {
frames['record'].window.location="page4.html";
}
// 'right' in the line above is what frame you want to change
// it can be either of the frame names you define below
// End -->
</SCRIPT>
Links: <a href="javascript: parent.frameNavig()">Page</a>
<a href="javascript: parent.frameNavig1()">Page1</a>
<a href="javascript: parent.frameNavig2()">Page2</a>
<a href="javascript: parent.frameNavig3()">Page3</a>
<a href="javascript: parent.frameNavig4()">Page4</a>
I hope this helps, if not you can scout out Java Script Source here:
http://javascript.internet.com/
I know there are several different scripts there for frame navigation.
Ralyn at 2007-11-11 23:35:57 >

# 4 Re: How to get url info from body frame
I am wondering if you are getting the Error Permissions denied, not because of the way the code was written, but because of a setting on your computer or the Browser.
I am a software tester and currently one of my apps that use JavaScript is giving me the Permission Denied Error on the lines using the parent.frameNavig() tag..
On one machine by simply refreshing the page the error goes away till revisiting the site. On other machines there is no Permissions error.