37
votes

I tried the following HTML page with two scripts:

<html>
  …
  <body>
    <script type="text/javascript">
      alert ('Javascript');
    </script>
    <script type="text/vbscript">
      msgbox "Vbscript"
    </script>
  </body>
</html>

On Windows 8.1 preview + Internet Explorer 11, the JavaScript worked, the VBScript did not.

On (Windows 8 + IE10), (Windows 7 + IE9), the two scripts worked.

I did not find any information about the end of VBScript support in Internet Explorer 11, did you?

6

6 Answers

61
votes

The IE team has been trying to retire VBScript for years.

http://msdn.microsoft.com/en-us/library/windows/apps/Hh700404.aspx indicates that support was removed from the ExecScript API. http://msdn.microsoft.com/en-us/library/ie/dn384057(v=vs.85).aspx explains that it's removed from IE11 Edge mode in the Internet Zone.

If you add the following to your HEAD tag, your VBScript will run:

<meta http-equiv="x-ua-compatible" content="IE=10">
13
votes

It actually very simple.

Only IE 10 and older supports VBScript. However you can easy change compatibility mode on IE 11 to IE 10 and it works perfectly fine.

I had the same issue: an old web site developed in 2004 using ASP and VBScript and the following procedure was the solution for me.

In order to change compatibility mode in IE 11 :

  1. Press F12 to open developer tools
  2. In left toolbar scrool down until you see "Emulation" settings page
  3. Change Document Mode from default ("Edge") to 10
  4. Enjoy your VBScript
6
votes

Actually I just had the same issue and found the resolution for myself. I also tried the way that EricLaw described but that didn't work for me. Here is what I found:

Open your website, go to Tools --> Compatibility View Settings, and then click Add (the website you are on should show in the form automatically), and you should be able to see the result.

5
votes

Another possible solution is to use HTA files I was struggling to save a tool that use simple HTML interface to survive our company migration from IE8 to IE11, and after a lot of investigation, this simple solution was found: rename files from file.html to file.hta

it is then openned by Microsoft HTML application host, which still support VBscript.

Downside is that not all CSS format are supported, but it's really easy to use this solution

3
votes

This is probably part of Microsoft's effort to make IE11 look like a standard browser.

IE11 removes all existing ways to check whether it's IE (other than actual specific feature detection that IE11 doesn't support yet).

The idea is that IE now works enough like a standard browser that any existing code with special cases for IE should no longer apply.

Checking for VBScript support is simply one of those obsolete checks that Microsoft wants to prevent.

2
votes

Try this HTA code:

<html><head>
<HTA:APPLICATION 
            ID              = "testHTA" 
            APPLICATIONNAME = "testHTA"
            VERSION         = "0.1"
            NAVIGABLE       = "yes"
            SHOWINTASKBAR   = "yes" 
            SINGLEINSTANCE  = "yes" 
            WINDOWSTATE     = "normal"
            BORDER          = "normal" 
            BORDERSTYLE     = "normal"
            INNERBORDER     = "no"    
            CAPTION         = "yes" 
            MINIMIZEBUTTON  = "yes"
            MAXIMIZEBUTTON  = "yes"
            SYSMENU         = "yes" 
            SCROLL          = "yes" 
            SCROLLFLAT      = "yes"    
            CONTEXTMENU     = "yes"
            SELECTION       = "yes"
        />
</head>
  <script language="javascript" type="text/javascript">
      function MyJsAlert() {
        alert('Hello world!  Opening notepad now...');
      }
  </script>
<script language="VBScript" type="text/vbscript">
MyJsAlert() 'executes javascript
' Create a Windows Shell object
set oShell = CreateObject("WScript.Shell")
oShell.CurrentDirectory = "c:\CAMEO\webapps\"
oShell.run("c:\windows\system32\notepad.exe")
</script>
</body></html>

Save the above code as an HTA file (i.e., test.hta), and launch in IE. This code mixes javascript and vbscript, and works in IE 11.