Ver Mensaje Individual
  #5  
Antiguo 11-01-2019
Avatar de dec
dec dec is offline
Moderador
 
Registrado: dic 2004
Ubicación: Alcobendas, Madrid, España
Posts: 13.107
Reputación: 34
dec Tiene un aura espectaculardec Tiene un aura espectacular
Hola a todos,

El compañero Ñuño me ha recordado otra posible causa del problema. Se trata de la versión de Internet Explorer que puede emular el componente "TWebBrowser". En efecto, si no hacemos nada más que poner un componente "TWebBrowser" en un formulario, dicho componente emulará una versión "antigua" de Internet Explorer, que, puede no ser compatible con los sitios web "modernos".

La siguiente unidad permite establecer la emulación de Internet Explorer 11, que, es suficiente (a día de hoy) para dar soporte a los sitios web "modernos" de que hablamos:

Código Delphi [-]
unit AppBuilder.Shared.BrowserFixes;

interface

type
  TBrowserFixes = class(TObject)
  public
    class procedure Initialize();
    class procedure Uninitialize();
  end;

implementation

uses
  // Delphi
  Winapi.Windows,
  System.SysUtils,
  System.Win.Registry;

const
  FEATURE_GPU_RENDERING_KEY = 'Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_GPU_RENDERING';
  FEATURE_BROWSER_EMULATION_KEY = 'Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION';

{ TBrowserFixes }

class procedure TBrowserFixes.Initialize();
var
  ExeName: string;
begin
  ExeName := ExtractFileName(ParamStr(0));
  with TRegistry.Create() do
  try
    RootKey := HKEY_CURRENT_USER;

    if OpenKey(FEATURE_BROWSER_EMULATION_KEY, True) then
    begin
      if not ValueExists(ExeName) then
      begin
        // http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx
        WriteInteger(ExeName, 11001);
      end;
      CloseKey();
    end;

    if OpenKey(FEATURE_GPU_RENDERING_KEY, True) then
    begin
      if not ValueExists(ExeName) then
      begin
        // https://msdn.microsoft.com/en-us/lib...=vs.85%29.aspx
        WriteInteger(ExeName, DWORD(1));
      end;
      CloseKey();
    end;

  finally
    Free();
  end;
end;

class procedure TBrowserFixes.Uninitialize();
var
  ExeName: string;
begin
  ExeName := ExtractFileName(ParamStr(0));

  with TRegistry.Create() do
  try
    RootKey := HKEY_CURRENT_USER;

    if OpenKey(FEATURE_BROWSER_EMULATION_KEY, False) then
    begin
      if ValueExists(ExeName) then
        DeleteValue(ExeName);
      CloseKey();
    end;

    if OpenKey(FEATURE_GPU_RENDERING_KEY, False) then
    begin
      if ValueExists(ExeName) then
        DeleteValue(ExeName);
      CloseKey();
    end;

  finally
    Free();
  end;
end;

initialization

finalization
  TBrowserFixes.Uninitialize();

end.

Para utilizar dicha unidad hay que incluirla en nuestro proyecto, y, a continuación usar el método "TBrowserFixes.Initialize()". Como puede verse, la propia unidad realiza el "Uninitialize" por sí sola. Adicionalmente (esto puede quitarse, si no se precisa, porque, no tiene que ver con la emulación de Internet Explorer) esta unidad también establece que el componente "TWebBrowser" "renderize" su contenido usando la GPU, si fuese posible.

He mencionado lo del "User agent", pero, lo cierto es que yo probaría primero con la "emulación" de Internet Explorer: es posible que esto solucione el problema y por tanto ya no sea necesario cambiar el "User agent".
__________________
David Esperalta
www.decsoftutils.com

Última edición por dec fecha: 11-01-2019 a las 08:32:07.
Responder Con Cita