Issue
I want to display: none
, the save
button , when my html page opens in iframe.
How can I do it ?
This link might help me , but I did not understand this link.
iframe code
<HTML>
<BODY>
<iframe id="myiFrame" src="file:///C:/Users/Prashant/Desktop/test.html"> </iframe>
</BODY>
</HTML>
test.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<BODY>
<button id="hideInIframe" >save</button>
<button id="getData" >get</button>
</BODY>
</HTML>
Solution
Use this:
if ( window.self !== window.top ) {
// you're in an iframe
}
Finally:
if ( window.self !== window.top ) {
$("#hideInIframe").css('display','none');
}
This way, each time test.html is in an iframe (of yours, or of anyone else), the save button is hide.
Answered By - 3pic Answer Checked By - Candace Johnson (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.