https://i.stack.imgur.com/G3Fbt.jpg
The mobile height is not big enough. Also, in the desktop mode, i still don't understand why my iframe has scroll bar even if there are no constraints on the containing div??? Why isn't it stretching the page with its full contents?
my error is:
TypeError: Cannot read property 'iFrameHeight' of null
I also tried the non-react way listed here:
https://stackoverflow.com/questions/42042901/setting-iframe-height-to-scrollheight-in-reactjs
But it doesn't work
Here's some of my code:
export default class SecondPage extends Component {
componentDidMount() {
const obj = ReactDOM.findDOMNode(this);
this.setState({ iFrameHeight: obj.contentWindow.document.body.scrollHeight + 'px' });
}
render() {
return (
<Layout>
<div className="iframe-container">
<iframe
src="https://www.1.com/1.php"
height={this.state.iFrameHeight}
style={{ "maxWidth": "100%", "border": "none", "overflow": "auto" }}>
<p>
<a href="https://www.1.com/1.php" title="Book Now">Button go</a>
</p>
</iframe>
</div>
</Layout>
);
}
}
my css:
.iframe-container {
overflow: hidden;
padding-top: 56.25%;
position: relative;
}
.iframe-container iframe {
border: 0;
height: 100%;
left: 0;
position: absolute;
top: 0;
width: 100%;
}