Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

History Function a iframe 1

Status
Not open for further replies.

ckennerdale

Programmer
Dec 23, 2000
158
GB
I am trying to set some forward and back buttons to control the content inside an iframe-

This is the code I have adapted from my navigation code I use if I have two frames, but it doesnt work despite naming the iframe.

Any ideas?
Thanks in advance.

--------

<html>
<head>
<script>
function goBack()
{
iFrame!.history.back();
}

function goForward()
{
iFrame!.history.forward();
}

</script>
</head>

<body bgcolor=&quot;#FFFFFF&quot; onLoad=&quot;LoadVars()&quot;>

<iframe name=&quot;iFrame!&quot; frameborder=&quot;0&quot; align=&quot;top&quot; noresize height=&quot;238&quot; width=&quot;176&quot; src=&quot; [Your Browser Does Not Support Inline Frames]
</iframe>

<br>
<a href=javascript:goBack();>back </a>-
<a href=javascript:goForward();>forward </a>-
</body>
</html> Caspar Kennerdale
Senior Media Developer
 
try changing the name to an id. jared@aauser.com
 
also having a ! in javascript means &quot;not&quot; - so try removing that from the name first. jared@aauser.com
 
Like


<iframe id=&quot;iFrame!&quot; frameborder=&quot;0&quot; align=&quot;top&quot; noresize height=&quot;238&quot; width=&quot;176&quot; src=&quot; [Your Browser Does Not Support Inline Frames]
</iframe>

It didnt work. Just get javascript error and no action.

I know this is something really simple I just can see it! Caspar Kennerdale
Senior Media Developer
 
you have a &quot;!&quot; in the id jared@aauser.com
 
I took this out and used a 1 instead-

and didnt work-

So this is the code I have now- it just returns an error when I hit the banck or forward link!

<html>
<head>
<script>
function goBack()
{
iFrame1.history.back();
}

function goForward()
{
iFrame1.history.forward();
}

</script>
</head>

<body bgcolor=&quot;#FFFFFF&quot;>

<iframe id=&quot;iFrame1&quot; frameborder=&quot;0&quot; align=&quot;top&quot; noresize height=&quot;238&quot; width=&quot;176&quot; src=&quot; [Your Browser Does Not Support Inline Frames]
</iframe>

<br>
<a href=javascript:goBack();>back </a>-
<a href=javascript:goForward();>forward </a>-
</body>
</html>
Caspar Kennerdale
Senior Media Developer
 
are you getting an &quot;access is denied&quot; error?. what is the error? jared@aauser.com
 
Just 'error on the page' in the stsus line.

If ypu copy and pste the exact code into a text editor and prview in anbrowser you should see wat I mean

I'm using IE 5.50

Its one of these things that should be working, but isnt

Thanks once again Caspar Kennerdale
Senior Media Developer
 
is the file you are viewing in the iframe from the same domain as the page you are viewing? if not, I don't think you can script it. I copied it and got an 'access is denied' error.

try doing this:

tools-->internet options-->advanced and check the box next to, &quot;Display a notification about every error&quot; that should help you debug jared@aauser.com
 
Thanks a lot

yeah it was working all the time, I was just looking locally, and there for the js security was kicking in-
I knew it was something very simple.

Thanks for the tip about the internet tools settings!

With regard to security can you not override this using some kind of UniversalBrowserRead privalege?

Would this go in the head of the source file- ie the page in the IFrame? Caspar Kennerdale
Senior Media Developer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top