Recently noticed an unpleasant feature. When you register in TWebBrowser: WebBrowser1.Navigate('about:'+ '[тут HTML код]');
Then re-call WebBrowser1.Navigate('about:'+ '[тут HTML код]'); updates the contents of WebBrowser1 and everything is fine.
But if you write:WebBrowser1.Navigate('http://domenname.ru/script.php');
then WebBrowser1 does not update dynamically changing content from php, until in the current IE browser you press F5 or right-click and on the contextual "Refresh".
I also noticed that even if you add WebBrowser1.Navigate('about:'+... , and then WebBrowser1.Navigate('http://domenname.ru/script.php'); again, then it will not update the contents anyway i.e. it takes content from its central IE cache.
How to eliminate this defect?
PS Can VK_F5 be sent to him somehow? But it does not work: PostMessage(Form1.WebBrowser1.Handle, WM_KEYDOWN, VK_F5, 0); does not workSendMessage(Form1.WebBrowser3.Handle, WM_KEYDOWN, VK_F5, 0); also does not work.
How to be straight I do not know, the whole life of a cat under the tail.
|
1 answer
Exit and position prompted here this note - clearing the cache IE programmatically.
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; Everything was updated, everything worked.
- oneAnd why didn’t the
TWebBrowser.RefreshorRefresh2methodRefresh2? Clearing the cache of all IE - well, this is somehow too ... - kami - @kami, and you try to practice. Create php, change it dynamically from conditions and see how your
TWebBrowser.Refreshwill work for it ... - I_CaR
|
WebBrowser1.Navigate('javascript:location.reload(true);')2) Maybe there is somewhere in the document there is a refresh function - I don’t remember exactly how to call. - nick_n_a