...

View Full Version : history.go(-1) in hta



Basscyst
02-02-2005, 06:46 PM
Why when I use history.go(-1) in an hta with an iframe does it not work? All the links in the menu open in the iframe, but when I add a back button, it does not do remember the history of the urls sent to the iframe. For example: (pardon the crappy design this is still WIP) If this can't be done, is there a way for me to show the standard IE toolbar in an hta?




<html>
<head>
<HTA:APPLICATION ID="oHTA"
APPLICATIONNAME="ERS15"
BORDER="thin"
BORDERSTYLE="normal"
CAPTION="yes"
ICON="\\carcrdsan1\carcrd-ops$\Dept_Apps\ERS\ers.ico"
MAXIMIZEBUTTON="yes"
MINIMIZEBUTTON="yes"
SHOWINTASKBAR="yes"
SINGLEINSTANCE="yes"
SYSMENU="yes"
VERSION="1.0"
>
<style>
ul a
{
border:outset 1px;
background-color:black;
color:white;
width:90%;
}
ul a:hover
{
color:#333399;
border:inset 1px;
background-color:white;
}
</style>
</head>
<body>
<form>
<input type="button" onclick="history.go(-1);" value="back"><input type="text" value="http://" style="width:93%" id="url" />&nbsp;<button onclick="document.main2.location.href=document.getElementById('url').value;">Go</button>
<br />
<div id="menu" style="width:100px;">
<ul style="margin:0px;padding:0px;">
<li><a href="http://infomanager.vzwcorp.com/" target="main2">IM Home</a></li>
<li><a href="contacts.html" target="main2">Contacts</a></li>
<li><a href="http://infomanagerdoc.ddc.vzwcorp.com/Infomanager/Areas/West/70848.htm" target="main2">CCD Check</a></li>
<li><a href="http://infomanagerdoc.ddc.vzwcorp.com/Infomanager/Areas/West/54815.htm" target="main2">National Plans</a></li>
<li><a href="http://infomanagerdoc.ddc.vzwcorp.com/Infomanager/Areas/West/57321.htm" target="main2">Local Plans</a></li>
<li><a href="http://infomanagerdoc.ddc.vzwcorp.com/Infomanager/Areas/West/46103.htm" target="main2">Pro-Calc</a></li>
<li><a href="http://infomanagerdoc.ddc.vzwcorp.com/infomanager/areas/west/2232.htm" target="main2">Equipment</a></li>
</ul>
<br />
<button onclick="document.getElementById('mem_link').href=document.main2.location.href">Set Link</button>
<br />
<br />
<a href="http://www.codingforums.com" id="mem_link" target="main2">Memory Link</a>
</div>
<iframe name="main2" src="http://infomanager.vzwcorp.com/" id="mn" height="550" width="850" style="border-bottom:solid 1px;position:absolute;left:105px;top:40px;"></iframe>
<textarea style="height:50px;width:250px;position:absolute;left:105px;top:600px;"></textarea>
</body>
</html>


Thanks,
Basscyst

Basscyst
02-02-2005, 07:44 PM
I think I figured it out, has nothing to do with the hta I don't think. Just that changing the source on an iframe doesn't seem to effect the history. Correct me if I am wrong.

Thanks,
Basscyst

canadianjameson
02-02-2005, 09:39 PM
though very uneducated, here be my guess.

an iframe is essentially a sub-container within the larger container (the page). from my understanding it is comparable on some levels to a DIV. The history.go function refers specifically to the URL position of the larger container (the main page). this is why when you open url's in the iframe and then use the history.go(-1) function it does not work.

i think you'd need to use an alternative to the history.go function to acheive what you want. something like this very poorly coded idea



[suedo code]

when a new link is loaded into the iframe, save the url of the link being unloaded into a variable called urlHistory
<SCRIPT language="JavaScript1.2">
function urlChecker()
{
if (iframe source != iframe default page)
{
load urlHistory into the iframe
}
else
{ history.go(-1) }
}
</script>
[/horrid suedo code]


:P

i tried



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum