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


<iframe src="">
<script type="vbscript">

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.SendKeys "%(A)"
Sleep 300
Who is Participating?
SphexiConnect With a Mentor Commented:
Most modern browsers support a META tag in the head section of your page, which can be used to refresh:

<meta http-equiv="refresh" content="300">

It would just refresh the current loaded page, and thus your iframe?  You can also specify a page to refresh if you need to include a querystring or parameters

<meta http-equiv="refresh" content="5; url=">

I've used it in a few pages that run on IE9/10, Chrome, and Firefox, all of which support it without an issue.
JWC_TNAuthor Commented:
Attempting to use the refresh will log out the user of the website instead of refreshing the content
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().


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

function RefreshIFrame() {
    document.getElementById('myiframe').src = '';

window.setInterval(RefreshIFrame, 60000);


Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.