Tuesday, July 7, 2015

IE problems

I. Something only works after you open the developer tool (F12)


In IE9, some functions related to console are only activated when the Developer Tool is opened.
For example, the console.dir(...) doesn't work unless the Developer Tool (F12) is open.
Tosolve this problem, we just need to use console.log(...) instead of console.dir(...). 
You can try console.dir([1,2]) and console.log([1,2]) to see the difference.

Related Link:

About the console:

Difference between console.log and console.dir:

II. Back button behavior on a page with Iframe

http://www.webdeveasy.com/back-button-behavior-on-a-page-with-an-iframe/

III. How to check whether a browser is IE 11
http://stackoverflow.com/questions/17907445/how-to-detect-ie11
if (navigator.appName == 'Microsoft Internet Explorer')
  {
    // Do something
    
  }
  else if (navigator.appName == 'Netscape')
  {
    // If you are here, it means your browser is not IE10 or IE older
    if (re.exec(ua) != null)
      // If you are here, it means your browser is IE11
  }