0

I'm trying to do the following:

    <iframe width="300">
      <script type="text/javascript" src="file.js" charset="utf-8"></script>
    </iframe>

But this constructions seems not working. What is the legitimate way to insert javascript file inside iframe using HTML and not calling javascript functions? Is it even possible?

1 Answer 1

2

You cannot add any content directly into an <iframe> tag. Even using JavaScript, you can add content only if the page in the iframe is from the same domain as the parent page.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.