An issue with TWebBrowser under delphi 7

This post is for delphi programmers.

I am trying to implement in one of my applications under delphi 7 a TWebBrowser component which is able to display web pages in the application, mainly pages of the site Deezer that can play music. My system is Windows 7 – 64 bits, and my delphi 7 is in 32 bits. So I installed the necessary ActiveX components according to the standard procedure: in the menu of delphi, under the tab Components, I click on the command Import ActiveX Control … and I install Microsoft Internet Controls (Version 1.1) and possibly for certain uses, but it is not necessary here, Microsoft HTML Object Library (Version 4.0). In the delphi menu, we obtain two (or possibly three) new components, including the TWebBrowser component that allows to display web pages, with the important reservation that the Microsoft Internet Explorer browser is installed on the system. In fact TWebBrowser uses the IE engine to display more or less complex web pages. As far as I am concerned, I have the latest version of IE11 installed.

The test application I propose is very simple. In a new delphi project, I create a Form, I put a TWebBrowser component and a TButton component and then, when I click on the button (called ‘Load‘), it loads a web page given by its url using the navigate method provided by TWebBrowser. The complete unit code is:

unit main;


Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, OleCtrls, SHDocVw_TLB;

TForm1 = class (TForm)
WebBrowser1: TWebBrowser;
Button1: TButton;
procedure Button1Click (Sender: TObject);
{Private declarations}
{Public declarations}

Form1: TForm1;


{$ R * .dfm}

procedure TForm1.Button1Click (Sender: TObject);
var url: widestring;
url: = 'https: //';
WebBrowser1.Navigate (url);


When I launch the application, everything seems fine. After clicking on the button Load, it loads the requested Deezer page, allowing to play a Polish song by Chopin. You can listen to it by clicking on the Deezer Play button. But next, there are unexpected behaviors.

1st surprise: If we click a second time on Load, then the same page is reloaded a second time, but the Play button does not do anything anymore.

2nd surprise: If we continue to click the Load button several times, then the page is still loading again, but only six times in total. From the seventh time, nothing is displayed and the TWebBrowser remains blank.

I found a solution to get round the first surprise: it is linked to the files that the Adobe Flash Player leaves in the Temporary Internet Files folder. The Play button will become active again, if before loading the url, we erase all the files having a name of the form coreplayer * .swf which can be located in this hidden directory or  in different subfolders.

On the contrary, despite days of research and testing, I did not find why the pages of Deezer only load 6 times. Here are some of my findings:

  • Only the pages pointing to a music track on Deezer, with an url like ‘’+ID, where ID represents the number of the track, have this behavior. Other websites, even if they contain videos or music, for example Youtube, are displayed an indefinite number of times.
  • The limitation to 6 displays is only present if the web page is displayed inside the Form. If we ask WebBrowser1 to display the url in a new window, adding a OleVariant variable Flags: = 1 to the procedure navigate, like WebBrowser1.Navigate (url, Flags); then Deezer’s pages are displayed an unlimited number of times, but of course each in a new external window, which is not my goal. This proves at least that it is not Deezer that imposes this limitation, because why would it have done that only for displays in a delphi application?
  • If you  run the delphi application several times at the same time, then you can load the Deezer page 6 times in each one.
  • When you leave such an application and restart it, the 6-fold counter starts again.
  • On the other hand, if we put two components TWebBrowser on the form, and at each click on the button we display a page of Deezer on both, then after 3 clicks the display becomes white. This proves that the limit of 6 is global for all TWebBrowser components in a delphi application.
  • Similarly, if within the application, the TWebBrowser component is destroyed and recreated, then the 6-fold counter does not start again. The limitation remains at 6 views in total, even if it is with TWebBrowser components that have been newly created in real time within the application.

To save yourself the trouble of giving me answers too general, you should know that I tried all versions of navigate or navigate2, with or without oleobject, I reinstalled the latest version of IE11, I cleared the cache or the history of ie11 between two clicks on the button, that I tried to place the TWebBrowser component on other components like a panel or a frame, that I modified the entries in the registry under FEATURE_BROWSER_EMULATION, that I tried to compile with or without debugging information, with or without optimization, that I launched my test application on other systems, including Windows 10. Nothing did work. Whenever I want to display a track of Deezer within my application, this limit to six displays applies.

For those who are interested in this problem, you can download below:

  • the executable file webbrowser.exe that everyone can download to see if this limitation to 6 views also applies on his system.
  • a zip containing the source code of the webbrowser project that programmers can open in delphi to do tests. But for this, they must have installed the TWebBrowser component in their delphi. If this is not done, I have indicated above how to do it.

If anyone finds a solution, or even just an explanation, then his name will appear in the Hall of Fame of this blog 😉

Add a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.