React.js iframe src

Viewed 8863

index.js

import React from 'react';
import ReactDOM from 'react-dom';

class App extends React.Component {
    render() {
        return (
            <div>
                <h1>Outside iFrame</h1>
                <iframe title="myiframe" src="./target.html" width="600px" height="400px"></iframe>
            </div>
        )
    }
}

ReactDOM.render(<App />, document.getElementById('root'));

index.html

<div id="root"></div>

target.html

<html>

<head></head>

<body>
    <h1>Inside IFrame</h1>
</body>

</html>

the Problem is like this:

enter image description here

what's wrong with the code?

1 Answers
Related