Published on: 31 Mar, 2016

How to check if a function in windows parent exists in Javascript?

Tumblr Digg Google Plus

When ever you try to reference a function from parent window, always perform a check if the function itself is exist. This will ensure there is no javascript error that can cause problem loading your site content or may cause a conflict with another javascript code.

To check if a function exists in the windows parent, you can use the following code.

if (typeof parent.functionName === "function") {
	//if exists perform your code here.


There are no comments available.

Write Comment
0 characters entered. Maximum characters allowed are 1000 characters.