Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts

    history.go(-1) in hta

    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?

    Code:
    <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
    Last edited by Basscyst; 02-02-2005 at 06:48 PM.
    Helping to build a bigger box. - Adam Matthews

  • #2
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts
    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
    Helping to build a bigger box. - Adam Matthews

  • #3
    Senior Coder
    Join Date
    Jul 2003
    Location
    My pimped-out igloo in Canadia
    Posts
    1,966
    Thanks
    36
    Thanked 0 Times in 0 Posts
    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

    Code:
    [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
    Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes :)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •