Επεξεργασία

Κοινή χρήση μέσω


Test your Office Add-in on Trident

If you plan to support older versions of Windows and Office, your add-in must work in the embeddable browser control called "Trident" that's provided by Internet Explorer 11. You can use a command line to switch from a more modern webview used by add-ins to Trident for this testing. For information about which versions of Windows and Office use the Internet Explorer 11 webview control, see Browsers and webview controls used by Office Add-ins. In this article, "webview" refers to the combination of a webview control and a JavaScript engine.

Important

Webviews from Internet Explorer and Microsoft Edge Legacy are still used in Office Add-ins

Some combinations of platforms and Office versions, including volume-licensed perpetual versions through Office 2019, still use the webview controls that come with Internet Explorer 11 (called "Trident") and Microsoft Edge Legacy (called "EdgeHTML") to host add-ins, as explained in Browsers and webview controls used by Office Add-ins. Internet Explorer 11 was disabled in Windows 10 and Windows 11 in February 2023, and the UI for launching it was removed; but it's still installed on with those operating systems. So, Trident and other functionality from Internet Explorer can still be called programmatically by Office.

We recommend (but don't require) that you support these combinations, at least in a minimal way, by providing users of your add-in a graceful failure message when your add-in is launched in these webviews. Keep these additional points in mind:

  • Office on the web no longer opens in Internet Explorer or Microsoft Edge Legacy. Consequently, AppSource doesn't test add-ins in Office on the web on these browsers.
  • AppSource still tests for combinations of platform and Office desktop versions that use Trident or EdgeHTML. However, it only issues a warning when the add-in doesn't support these webviews; the add-in isn't rejected by AppSource.
  • The Script Lab tool no longer supports Trident.

If you plan to support older versions of Windows and Office, your add-in must work in the embeddable browser control called "Trident" that's provided by Internet Explorer 11. You can use a command line to switch from a more modern webview used by add-ins to Trident for this testing. For information about which versions of Windows and Office use the Internet Explorer 11 webview control, see Browsers and webview controls used by Office Add-ins.

Important

Trident doesn't support JavaScript versions later than ES5. If you want to use the syntax and features of ECMAScript 2015 or later, you have to use a transpiler or polyfill or both. For more information about these options, see Support older Microsoft webviews and Office versions.

Also, Trident doesn't support some HTML5 features such as media, recording, and location. To learn more, see Determine the webview the add-in is running in at runtime.

Note

  • Office on the web can't be opened in Internet Explorer 11, so you can't (and don't need to) test your add-in on Office on the web with Internet Explorer.

  • Internet Explorer's Enhanced Security Configuration (ESC) must be turned off for Office Web Add-ins to work. If you're using a Windows Server computer as your client when developing add-ins, note that ESC is turned on by default in Windows Server.

Switch to the Trident webview

Tip

In recent versions of Office, one way to identify the webview control that Office is using is through the personality menu on any add-in where it's available. (The personality menu isn't supported in Outlook.) Open the menu and select Security Info. In the Security Info dialog on Windows, the Runtime reports Microsoft Edge, Microsoft Edge Legacy, or Internet Explorer. The runtime isn't included on the dialog in older versions of Office.

There are two ways to switch the Trident webview. You can run a simple command in a command prompt, or you can install a version of Office that uses Trident by default. We recommend the first method, but you should use the second in the following scenarios.

  • Your project was developed with Visual Studio and IIS. It isn't Node.js based.
  • You want to be absolutely robust in your testing.
  • You can't use the Beta channel for Microsoft 365 on your development computer.
  • You're developing on a Mac.
  • If for any reason the command line tool doesn't work.

Switch via the command line

If your project is Node.js-based (that is, not developed with Visual Studio and Internet Information server (IIS)), you can force Office on Windows to use either the EdgeHTML webview control that is provided by Edge Legacy or the Trident webview control that is provided by Internet Explorer to run add-ins, even if you have a combination of Windows and Office versions that would normally use a more recent webview. For more information about which browsers and webviews are used by various combinations of Windows and Office versions, see Browsers and webview controls used by Office Add-ins.

Note

The tool that's used to force the change in webview is supported only in the Beta subscription channel of Microsoft 365. Join the Microsoft 365 Insider program and select the Beta Channel option to access Office Beta builds. See also About Office: What version of Office am I using?.

Strictly, it's the webview switch of this tool (see Step 2) that requires the Beta channel. The tool has other switches that don't have this requirement.

  1. If your project was not created with the Yeoman generator for Office Add-ins tool, you need to install the office-addin-dev-settings tool. Run the following command in a command prompt.

    npm install office-addin-dev-settings --save-dev
    

    Important

    The office-addin-dev-settings tool is not supported on Mac.

  2. Specify the webview that you want Office to use with the following command in a command prompt in the root of the project. Replace <path-to-manifest> with the relative path, which is just the manifest filename if it's in the root of the project. Replace <webview> with either ie or edge-legacy. Note that the options are named after the browsers in which the webviews originated. The ie option means "Trident" and the edge-legacy option means "EdgeHTML".

    npx office-addin-dev-settings webview <path-to-manifest> <webview>
    

    The following are examples.

    npx office-addin-dev-settings webview manifest.xml ie
    
    npx office-addin-dev-settings webview manifest.json edge-legacy
    

    You should see a message in the command line that the webview type is now set to IE (or Edge Legacy).

  3. When you're finished, set Office to resume using the default webview for your combination of Windows and Office versions with the following command.

    npx office-addin-dev-settings webview <path-to-manifest> default
    

Install a version of Office that uses Internet Explorer

Use the following procedure to install either a version of Office (downloaded from a Microsoft 365 subscription) that uses the Microsoft Edge Legacy webview (EdgeHTML) to run add-ins or a version that uses Internet Explorer (Trident).

  1. In any Office application, open the File tab on the ribbon, and then select Office Account or Account. Select the About host-name button (for example, About Word).

  2. On the dialog that opens, find the full xx.x.xxxxx.xxxxx build number and make a copy of it somewhere.

  3. Download the Office Deployment Tool.

  4. Run the downloaded file to extract the tool. You are prompted to choose where to install the tool.

  5. In the folder where you installed the tool (where the setup.exe file is located), create a text file with the name config.xml and add the following contents.

    <Configuration>
      <Add OfficeClientEdition="64" Channel="SemiAnnual" Version="16.0.xxxxx.xxxxx">
        <Product ID="O365ProPlusRetail">
          <Language ID="en-us" />
        </Product>
      </Add>
    </Configuration>
    
  6. Change the Version value.

    • To install a version that uses EdgeHTML, change it to 16.0.11929.20946.
    • To install a version that uses Trident, change it to 16.0.10730.20348.
  7. Optionally, change the value of OfficeClientEdition to "32" to install 32-bit Office, and change the Language ID value as needed to install Office in a different language.

  8. Open a command prompt as an administrator.

  9. Navigate to the folder with the setup.exe and config.xml files.

  10. Run the following command.

    setup.exe /configure config.xml
    

    This command installs Office. The process may take several minutes.

  11. Clear the Office cache.

Important

After installation, be sure that you turn off automatic updating of Office, so that Office isn't updated to a version that doesn't use webview you want to work with before you've completed using it. This can happen within minutes of installation. Follow these steps.

  1. Start any Office application and open a new document.
  2. Open the File tab on the ribbon, and then select Office Account or Account.
  3. In the Product Information column, select Update Options, and then select Disable Updates. If that option isn't available, then Office is already configured to not update automatically.

When you are finished using the old version of Office, reinstall your newer version by editing the config.xml file and changing the Version to the build number that you copied earlier. Then repeat the setup.exe /configure config.xml command in an administrator command prompt. Optionally, re-enable automatic updates.

See also