HewsonJ Posted April 25, 2018 Posted April 25, 2018 We've embedded a website using HTML (because the page we've embedded was so small using the built in widget was a literal waste of space) but I am wondering if you can execute JavaScript within the HTML widget? <script> window.setInterval("reloadIFrame();", 3000); function reloadIFrame() { document.frames["Name1"].location.reload(); } </script> <iframe src="URL" id="Name1" style=" height: 70px; border:0px; padding:0px; margin:0px;"></iframe> Is it my code that's incorrect (should it be the name tag rather than id in the iframe for example) or is it just a limitation of the widget we're using? It's a status checker for another service we use that allows us to see if the service needs restarting at any of our schools.
Simon Law Posted April 27, 2018 Posted April 27, 2018 Yes, you can. The HTML widget literally inserts whatever you put in the widget onto the site it is on. I will test you code and find out why it's not working
HewsonJ Posted April 27, 2018 Author Posted April 27, 2018 Thanks, I know that the id in the iframe should be name but so far I can't get it to work.
Simon Law Posted April 27, 2018 Posted April 27, 2018 <script> function reloadIFrame() { document.Name1.location.reload(); } window.setInterval(reloadIFrame, 3000); </script> <iframe src="URL" name="Name1" style="height:70px;border:0px;padding:0px;margin:0px;"></iframe> couple of slight changes, good to go (after you change URL to a real URL
Simon Law Posted April 27, 2018 Posted April 27, 2018 We tend to use Chrome and always have the developer tools window open, the error console usually shows you what's wrong
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now