Does IE9 enable 'something' when using dev

2019-02-22 01:55发布

Im using Google Maps Javascript API V3, and recently the icons on my map aren't showing up in IE9.

To get to the bottom of it, I turned on IE's developer tools. When I refreshed the map, the icons appeared! However, when I close out of IE and start anew, the icons aren't there. Yet again, if I turn on the developer tools and refresh, the icons appear.

My question is the title of this topic, what is enabled when accessing IE's developer tools, which is allowing my icons on my Google map to appear??

2条回答
我命由我不由天
2楼-- · 2019-02-22 02:27

If you have any console prints in your code, these would throw exceptions (hence breaking the javascript after it) if the page was loaded when the developer tools were closed.

to fix this, wrap your prints in an if statement:

if (console) {
   console.log('...');
}
查看更多
时光不老,我们不散
3楼-- · 2019-02-22 02:37

Any references to the global console object will only work if the IE Developer Tools are open. If the developer tools are closed, the global console object is undefined.

For example, the following code will only run if the developer tools are open. If they're closed, they'll throw an error about console being undefined:

console.log("test");
查看更多
登录 后发表回答