By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,520 Members | 1,246 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,520 IT Pros & Developers. It's quick & easy.

Working with iframe history

P: 11
Hi everybody!

I'm using iframes in my most recent WebDev project called "Felix" and would like to know how I can use Javascript to make a back button for the iframe. Here's the code I have:

Expand|Select|Wrap|Line Numbers
  1. <input type="button" style="width:64px" onclick="javascript:document.getElementById('pHubiframe_resource').history.go(-1)" value="&larr;Back" />
When I use that code, I get a JScript error that pHubiframe_resource doesn't support the history.go function, if I remember correctly. Thanks in advance.
Jun 28 '08 #1
Share this Question
Share on Google+
2 Replies


P: 11
UPDATE:

I've changed it to just

Expand|Select|Wrap|Line Numbers
  1. ...onclick="javascript:history.go(-1)"...
and it works, but it opens up the possibility for my entire page to go back to a completely different page all together. Is there a way to make it so that the button becomes disabled when the first page (which is "about:blank", but it doesn't index : / )?
Jun 28 '08 #2

acoder
Expert Mod 15k+
P: 16,027
If you give your frames a name and access them using frames[frameName], you could call history.back() on them.
Jun 29 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.