Tip of the day: Check if Page is Opened in iFrame

Checking this is javascript is straight forward. Check if the window is same as its parent window. If this is the case, it is not an iFrame otherwise, it is an iFrame.

if (window.self === window.top){
	console.log("Not iFrame");
} else {
	console.log("iFrame");
}

 


Leave A Comment

Your email address will not be published. Required fields are marked *