Link to home
Start Free TrialLog in
Avatar of JWC_TN
JWC_TN

asked on

Sendkey to HTML iFram

I need to have a website open in an iframe and every few minutes send alt A to refresh the contents of the website.  Below is the code I have that is not working

<html>
<body>

<iframe src="www.websiteneededrefreshed.com/">
<script type="vbscript">

Set WshShell = WScript.CreateObject("WScript.Shell")
Do
WshShell.SendKeys "%(A)"
Sleep 300
Loop
</script>
</iframe>
</body>
</html>
ASKER CERTIFIED SOLUTION
Avatar of Sphexi
Sphexi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JWC_TN
JWC_TN

ASKER

Attempting to use the refresh will log out the user of the website instead of refreshing the content
Avatar of sybe
In html it is more common to use javascript. Write a javascript that will set the src of the iframe every x seconds. The javascript function to use for that is setInterval().


<html>
<body>

<iframe id="myiframe" src="">

<script>
function RefreshIFrame() {
    document.getElementById('myiframe').src = 'http://www.websiteneededrefreshed.com/';
}

window.setInterval(RefreshIFrame, 60000);

</script>

</body>
</html>