Code running inside chrome extension check
(function () {
var isChrome = (function () {
var contentWindow,
iframe = document.createElement("iframe"),
isChrome;
if ("sandbox" in iframe) {
try {
iframe.sandbox = "allow-same-origin";
iframe.src='/';
iframe.style="display: none";
document.body.appendChild(iframe);
contentWindow = iframe.contentWindow;
isChrome = (contentWindow.chrome && contentWindow.chrome.extension);
document.body.removeChild(iframe);
} catch(e) {}
} else {
isChrome = false;
}
return isChrome;
}());
}());