Run js-test-driver Eclipse plugin in IE8 document mode when having IE9 installed

103 Views Asked by At

I want to use the Eclipse plugin of js test driver to execute my tests in IE. I have IE9 installed but want the tests to run in IE8 document mode because this is what the app we are developing is running in.

So is there any way to start the js-test-driver plugin in IE8 document mode when having IE9 installed? Its possible to switch mode in MS Developer Tools but that is not what I'm looking for.

I've tried to load a script that adds meta tags at start up by adding a script like this in the jsTestDriver.conf file:

... 
load: 
   - js/bootstrap-IE8.js
...

and the code in the bootstrap file:

(function(){
   var meta = document.createElement('meta');
   meta.setAttribute('http-equiv','X-UA-Compatible');
   meta.setAttribute('content','IE=8');

   var meta2 = document.createElement('meta');
   meta2.setAttribute('Content-Type','X-UA-Compatible');
   meta2.setAttribute('content','text/html; charset=utf-8');

   var tophead = top.document.getElementsByTagName('head')[0];
   var toptitle = tophead.firstChild;

   tophead.insertBefore(meta, toptitle);
   tophead.insertBefore(meta2, toptitle);
})();
1

There are 1 best solutions below

0
On

I have tried to find a way to solve this as you describe have not found any way to do this (or JSTestDriver files to modify)

However, this can be done by modifing the registry by setting FEATURE_BROWSER_EMULATION feature that defines the default emulation mode for Internet Explorer to 8888 (0x22B8).

It is descibed at http://msdn.microsoft.com/en-us/library/ee330730%28VS.85%29.aspx#browser_emulation

Note that your browser will use IE8 document mode always.