TwebBrowser Delphi - how to make analog F5



  • I've recently noticed an unpleasant feature. When you write in TWebBrowser: WebBrowser1.Navigate('about:'+ '[тут HTML код]');
    That re-call. WebBrowser1.Navigate('about:'+ '[тут HTML код]'); updates WebBrowser1 content and it's okay.
    But if you write,
    WebBrowser1.Navigate('http://domenname.ru/script.php');
    the WebBrowser1 doesn't update the dynamically changing content of the php until you press the F5 or the right button and the contextual "Renew."
    I also noticed that if I even put it up, WebBrowser1.Navigate('about:'+...And then again. WebBrowser1.Navigate('http://domenname.ru/script.php');Anyway, he won't update the contents, that is, he's taking the contents from his central cash IE.
    How do we eliminate this misunderstanding?
    P.S. Should we send a VK_F5 somewhere? But it doesn't work. PostMessage(Form1.WebBrowser1.Handle, WM_KEYDOWN, VK_F5, 0); Not working.
    SendMessage(Form1.WebBrowser3.Handle, WM_KEYDOWN, VK_F5, 0); It doesn't work either.
    I don't know how to be, the whole life of a cat's tail.


  • QA Engineer

    Exit and position http://www.delphisources.ru/pages/faq/base/click_clear_cache_btn_in_ie.html - Cleaning the IE cash with the software.
    Implementation:

    procedure TForm1.Button1Click(Sender: TObject);
    var
    

    lpEntryInfo : PInternetCacheEntryInfo;
    hCacheDir : LongWord;
    dwEntrySize : LongWord;
    dwLastError : LongWord;

    begin

    dwEntrySize := 0;
    FindFirstUrlCacheEntry(nil, TInternetCacheEntryInfo(nil^ ), dwEntrySize);
    GetMem(lpEntryInfo, dwEntrySize);
    hCacheDir := FindFirstUrlCacheEntry(nil, lpEntryInfo^, dwEntrySize);
    if (hCacheDir <> 0) then
    DeleteUrlCacheEntry(lpEntryInfo^.lpszSourceUrlName);
    FreeMem(lpEntryInfo);
    repeat
    dwEntrySize := 0;
    FindNextUrlCacheEntry(hCacheDir, TInternetCacheEntryInfo(nil^ ), dwEntrySize);
    dwLastError := GetLastError;
    if (GetLastError = ERROR_INSUFFICIENT_BUFFER) then
    begin
    GetMem(lpEntryInfo, dwEntrySize);
    if (FindNextUrlCacheEntry(hCacheDir, lpEntryInfo^, dwEntrySize)) then
    DeleteUrlCacheEntry(lpEntryInfo^.lpszSourceUrlName);
    FreeMem(lpEntryInfo);
    end;
    until
    (dwLastError = ERROR_NO_MORE_ITEMS);

    WebBrowser1.Navigate('http://domenname.ru/script.php');

    end;

    It's been updated, it's working.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2