Skip to content

Instantly share code, notes, and snippets.

@mkelley82
Last active June 13, 2016 22:37
Show Gist options
  • Save mkelley82/501fa56a093a7edbc39467aa4021bb99 to your computer and use it in GitHub Desktop.
Save mkelley82/501fa56a093a7edbc39467aa4021bb99 to your computer and use it in GitHub Desktop.
var doesDefinePropertyWork = function doesDefinePropertyWork(object) {
try {
Object.defineProperty(object, 'sentinel', {});
return 'sentinel' in object;
} catch (exception) {
return false;
}
};
var definePropertyWorksOnObject = doesDefinePropertyWork({});
if (!definePropertyWorksOnObject) {
// Object.defineProperty does not work on object
window.location.replace('http://www.example.com')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment