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 7 of 7
  1. #1
    Regular Coder
    Join Date
    Apr 2006
    Posts
    311
    Thanks
    17
    Thanked 0 Times in 0 Posts

    Can't refresh/reload.hta

    Hey All,

    Gosh, I couldn't find the HTA users forum (wonder why that is? )
    so I hope this post is as well placed here as anywhere?

    I have a little hta running from a windows scheduled task,
    which calls a couple of files (from two different servers) into
    respective iframes in the hta.

    Was running 'window.close()' if one of the files (mysql_query.php) echo's a 'true' result
    (sync_blocking.status='true') better luck next time the task runs...

    I would much prefer to run 'window.reload()' (try again) untill result returns 'false',
    but I keep getting permission denied errors for the dozens of different reload/refresh/history options I have tried.
    (window/document/parent/location ... how many ways to skin that cat anyway?)

    I can do this...
    PHP Code:
        function alternative(){
            
    parent.StartThis('C:\\AreaPro\\checkStatus.hta'); 
            
    window.close(); 
    Which is a REALLY UGLY SOLUTION... , but I can't do ANYTHING like this "window.location.reload();"without a Permission Denied error.
    Please, can anyone offer any good reason why the following wouldn't work?
    (abreviated it as best I could, but thought it important to present in context)
    PHP Code:
    <html>    
        <
    head>
     <
    TITLE>Area Pro Sync</TITLE>

    <
    HTA:APPLICATION id="checkStatusHTA" 
    applicationName="checkStatus" 
    border="thin"
    borderStyle="normal"
    caption="yes"
    icon="C:\AreaPro\sync3.ico"
    maximizeButton="yes"
    minimizeButton="yes"
    showInTaskbar="yes"
    windowState="normal"
    innerBorder="yes"
    navigable="yes"
    scroll="no"
    scrollFlat="yes"
    singleInstance="no" 
    sysMenu="yes"
    contextMenu="yes"
    selection="yes" 
    application="yes"
    version="1.0" />

    <
    script language="javascript" type="text/javascript">
        
    window.resizeTo(400,600);
        
    self.moveTo(300,50);

        var 
    shellObject = new ActiveXObject("Shell.Application");
        function 
    StartThis(CommandToRun)
            {
            
    shellObject.open(CommandToRun)
            }

    function 
    verify_connection()
        {
        var 
    connected document.getElementById('connected');
        var 
    check_statusIframe document.getElementById('check_statusIframe');
            if(
    connected.value!='false')
                {
                
    setTimeout("check_statusIframe.src='http://mydomain.com/crm/checkStatus.php'",3000);
                }
            else{
                
    //alert("no connection")
                
    window.close();    
                }
        }

    function 
    start_Sync(){
            
    parent.StartThis('C:\\AreaPro\\bg_Sync.bat'); 
            
    window.close();
            }

        function 
    alternative(){
        
    parent.location.reload();//try again until checkStatus.php echos startSync();
    }
    </script>
        </head>
    <!-- verify host connection first - if(connected){run scripts} else{close/abort} -->
    <body onload="verify_connection();">
        <img src="http://mydomain.com/connected.gif" onError="document.getElementById('connected').value='false';"> 
        <input type="hidden" id ="connected">
    <!-- END verify connection -->

    <iframe id="pirmary_userIframe" width="200" height="100" frameborder="1" application="yes" border="1" src="http://localhost/crm/get_prime_user.php">
        </iframe>
    <iframe id="check_statusIframe" width="400" height="40" frameborder="1" application="yes" border="1">
        </iframe>
    </body>
    </html> 

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    While an hta is a little more lax on security I still believe you can't reload an iframe if its from an external url unless I'm missing something. What are you trying to reload? The .hta file or the iframe?
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    Regular Coder
    Join Date
    Apr 2006
    Posts
    311
    Thanks
    17
    Thanked 0 Times in 0 Posts
    Well, I think I have succeeded in reloading the iframes (both of them)
    but REALLLY want to reload the HTA.

    Thanks!

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Try the other ways mentioned here
    http://www.mediacollege.com/internet...ge/reload.html
    If those don't work you could also try a meta refresh.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #5
    Regular Coder
    Join Date
    Apr 2006
    Posts
    311
    Thanks
    17
    Thanked 0 Times in 0 Posts
    Thanks Aero,
    I've tried ALL those, 100 variations on them and few othes to boot
    history.go(0) is as close as I've gotten, which (like a simple refresh from the browser) Alerts "Page cannot be refreshed without resending the information. -- RETRY"

    This of course will never do in a task scheduled by a bakground windows user
    (cause you'd never see it run to click retry).

    Which leaves my scrathching mE head (wait -- is that blood under my fingernails ? !!! ?) wondering....

    WHAT information is it that must be RE SENT ????

  • #6
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    You have something posting to the server so refreshing the page will try to repost the information back to the server. You may want to look into using ajax to get the response from the server.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #7
    Regular Coder
    Join Date
    Apr 2006
    Posts
    311
    Thanks
    17
    Thanked 0 Times in 0 Posts
    Thanks Again for your help Aero,

    No end to the learning curve here is there?
    Ajax has been knocking on my door for months.

    I'm pretending I'm not home.

    Strangely (to me anyway) I was able to echo the following from checkStatus.php, and it works like a charm! Go figure.
    PHP Code:
    echo "<script>
    if(window.parent.is_checkStatus_hta)
    {
    //try again until $status =='no' && checkStatus.php echos startSync();
      window.parent.location.reload();
      }
    </script>"



  •  

    Posting Permissions

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