Help on controling a webpage from within a frame?

liunx

Guest
I am trying to use a frame with a back and forward page button, but when I try and go back a page I get an access is denied to controls.html file error. I've copied my code hoping someone may help me find a solution.<br />
<br />
<br />
SiteNavigator.html --------<br />
<br />
<html><br />
<title>Site Navigator</title><br />
<head><br />
</head><br />
<frameset rows="90%,10%"><br />
<frame src=http://www.htmlforums.com/archive/index.php/"" Name="main"><br />
<frame src=http://www.htmlforums.com/archive/index.php/"Controls.html" Name="controls"><br />
</frameset><br />
</html><br />
<br />
<br />
<br />
Controls.html -------<br />
<br />
<html><br />
<body><br />
<form name="controls"><br />
URL Address:<br />
<input type="text" name="newURL" value="http://"><br />
<input type="button" name="goto" value=" Go To "<br />
onClick="parent.frames[0].location.href=http://www.htmlforums.com/archive/index.php/document.controls.newURL.value;"><br />
<input type="button" Name="previous" value=" Previous URL "<br />
onClick="parent.frames[0].history.go(-1);"><br />
<input type="button" name="next" value=" Next URL "<br />
onClick="parent.frames[0].history.go(1);"><br />
</form><br />
</body><br />
</html><!--content-->It seems like if you opened your browser right up to this page and, hence, had no history(-1) that your browser would bomb out in some fashion, but that's about all I can think of.<br />
<br />
Might I ask why you want something like that? And, if it's truly necessary to have, then I think you'd want to run some Server Side code to verify that this were more "previous" pages in the browser's history.<!--content-->The controls.html page has an input field to link to a new webpage in the top part of the frame, I know that if I have no history the back and forward buttons will error, but even when I use the 'newURL' textbox to move to a new page I still get this error:<br />
<br />
Line: 14<br />
Char: 1<br />
Error: Access is denied.<br />
Code:0<br />
URL: <!-- m --><a class="postlink" href="file://C">file://C</a><!-- m -->:\Documents and settings\dcruz01\My Documents\Programming\JavaScript\Controls.html<br />
<br />
I thought it might have something to do with IE, I read in IE the history reference only works if you stay within the same domain, however it still doesn't work even if I stay within a specific domain.<!--content-->what is the file in question? what are lines 10-16<!--content-->The file in question is controls.html, clearly there are 2 different HTML files used here because it is a frame.<!--content-->could you post a link to the page(s) - would like to see the output as well as the code to see what you're trying to do.<br />
<br />
Cheers,<br />
HK<!--content-->Well, I finally got it working. All I had to do for anyone who's interested is change the Controls.html file so that the forward and back buttons don't refer to the parent. Otherwise IE can only navigate through webpages that exist in the same domain as the javascript code.<br />
<br />
<form name="controls"><br />
URL Address:<br />
<input type="text" name="newURL" value="http://"><br />
<input type="button" name="goto" value=" Go To "<br />
onClick="parent.frames[0].location.href=http://www.htmlforums.com/archive/index.php/document.controls.newURL.value;"><br />
<input type="button" Name="previous" value=" Previous URL "<br />
onClick="history.go(-1);"><br />
<input type="button" name="next" value=" Next URL "<br />
onClick="history.go(1);"><!--content-->Originally posted by cruz878 <br />
The file in question is controls.html, clearly there are 2 different HTML files used here because it is a frame. <br />
yes I realize that but there is only 14 lines in your control.html page that you have shown. there has to be something else you have not shown us. line 14 is the closing html tag. the one it is erroring out on is the history.go(-1) back button.<br />
<br />
looks like you are running it from your c drive in win2000 and that might be the problem. try doing it online<br />
<br />
well it does the samthing for me as well BUT works just fine in mozilla.<!--content-->I apologize, when I pasted the code to the forum I removed all the blank lines, line 14 should have been th onClick event handler for the backpage.<br />
<br />
Anyway thanks for all the help..<!--content-->
 
Back
Top