hide and show an iframe, html. Please make it noob friendly
It's being caused by a security feature implemented by your brower: (all those CORB errors)
"
You can't access an <iframe>
with different origin using JavaScript, it would be a huge security flaw if you could do it. For the same-origin policy browsers block scripts trying to access a frame with a different origin.
Origin is considered different if at least one of the following parts of the address isn't maintained:
<protocol>://<hostname>:<port>/path/to/page.html
Protocol, hostname and port must be the same of your domain, if you want to access a frame
"
Maybe try switching the target to a nesting div:
<button onclick="displayToggle('iframe')">Toggle</button>
<div id=iframe>
<div class="frame"> <iframe src="https://www.vg.no/" style="border:5px #ffffff none;" name="iframes" scrolling="yes" frameborder="1" height="800px" width="700px" allowfullscreen></iframe> </div> </div>
Not sure if that will get around it, but that is what I'd try first.
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