Open a Website in HTA application

前提是你 提交于 2019-12-23 02:38:40

问题


So, I have this small local website, which is the website that opens when you open router configuration. that is, 192.168.0.1. the one in which we make settings for the router. I need to open that website very frequently for turning the wireless on and off and I have to do it via a browser. Its bit of a heavy process, so I decided to switch to one click HTA applications which makes the work very Quick.
The thing is, whenever the home screen of that website opens, where you have to put the router password, after inputting the proper password, the website in the HTA won't redirect to the Preferences page, like it does in the Browser. It stays at the Login page and I have no idea if I have to put some extra piece of code in my HTA. Please help.

Below is the code.

<html>
    <head> 
    </head> 
    <body> 
        <iframe src="http://192.168.0.1" width="100%" height="100%"> 
    </body> 
</html>

回答1:


Because of the security risk that HTAs can pose accessing URLs through <iframe> tags is locked down, but you can tell the engine that a <iframe> is trusted by adding the application="yes" attribute.

Quote from Introduction to HTML Applications (HTAs)
Section: The Power of Trust: HTAs and Security


HTAs are designed such that untrusted HTML frame and iframe objects have no script access to the HTA containing them. In the case of frame objects that are not HTA-enabled, the highest level frame comprises the top window for all frame objects it contains. For that frame object, the window.top and window.self properties are one and the same. In addition, unsafe frame and iframe objects receive neither a referrer nor an opener URL from the parent HTA. The end result is that they are unaware of the containing HTA as the parent window.

Using the example in the question;

<html>
    <head>
        <HTA:APPLICATION
            APPLICATIONNAME="Test"
            ID="TestApp"
            VERSION="1.0"/>
    </head> 
    <body> 
      <iframe src="http://192.168.0.1" width="100%" height="100%" application="yes"> 
    </body> 
</html>

Useful Links

  • Introduction to HTML Applications (HTAs)



回答2:


Try adding this Property in the HTA:APPLICATION tag :

NAVIGABLE="YES"

Also, keep application = "No"



来源:https://stackoverflow.com/questions/36194448/open-a-website-in-hta-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!