window.device undefined, debugging