PDA

View Full Version : help making a script to find the url of a frame



Christian271
Jun 16th, 2008, 11:20 PM
I need help making a script to find the url of a frame. For example, in this piece of code

<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>My Toolbar</title>
</head>
<frameset rows="28,*">
<frame src="my_toolbar.htm" scrolling=no marginwidth=0 marginheight=0>
<frame src="http://therealmers.divinusdies.net" name="content">
</frameset>
</html>
the script would come up with the url of frame "content" being http://therealmers.divinusdies.net. Does anybody have any ideas?

binaryWeapon
Jun 17th, 2008, 08:47 PM
parent.frames["content"].location.href should work.

Christian271
Jun 17th, 2008, 09:06 PM
It's not working, dose it mater that the site in the frame belong to a different domain?

thanks for your help!:D

binaryWeapon
Jun 17th, 2008, 09:25 PM
You can't access the DOM of another site, but if the actual frame element is on your domain, you should be able to access it. What page are you using the code on? Are you trying to use it with the page that contains the code from your original post?

Christian271
Jun 17th, 2008, 09:54 PM
Here's the code for the page I'm using it on,(mytoolbar.t35.com/my_toolbar.htm)


<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>My Toolbar</title>
<body background=images/bg.jpg>
</head>

<form name="toolbar">
| <select name="search">
<option value="http://">Web Address</option>
<option value="http://www.ask.com/web?qsrc=167&o=0&l=dir&q=">Ask</option>
<option value="http://www.google.com/search?hl=en&q=">Google</option>
<option value="http://search.yahoo.com/search;_ylt=A0oGkle.AVdI0j8B7tlXNyoA?p=">Yahoo!</option>
<option value="http://en.wikipedia.org/wiki/">Wikipedia</option>
<option value="http://wiki.answers.com/Q/Special:Search&search=">WikiAnswer</option>
<input name="urlinput">
<input type="button" value="Go"
onClick="parent.content.location.href = toolbar.search.value + toolbar.urlinput.value">
<input type="button" value="T"
onClick="toolbar.urlinput.value = parent.frames["content"].location.href">
</form>

</html>


and here's the code for the page I'm loading the first page in and the frame I want to find the url of,


<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>My Toolbar</title>
</head>

<frameset rows="28,*">
<frame src="my_toolbar.htm" scrolling=no marginwidth=0 marginheight=0>
<frame src="http://therealmers.divinusdies.net" name="content" value="ih">
</frameset>
</html>

Christian271
Jun 22nd, 2008, 06:05 PM
Anybody have any ideas?