Wednesday, 8 June 2011

Detecting undefined object property - Javascript

while checking the top.location.search object against unknown works smoothly in other browsers except Chrome and Safari. Finally found that we need to check the object for undefined also. So to make it work fine for all the browsers check the object always for undefined and unknown.
(typeof top.location.search!='undefined' && typeof top.location.search != 'unknown')

No comments:

Post a Comment