none
How to enforce COM API Navigate2 not to use cache? RRS feed

  • Question

  • Hi All, 

    I am developing extension on IE 11. I found that the COM API Navigate2 does not always refresh from the server, please refer to the following PowerShell script

    $IE = New-Object -ComObject "InternetExplorer.Application"
    #test URL1
    $Url1 = "https://www.google.com"
    #test URL2, a very simple test page
    $Url2 = "http://192.168.132.5/mytest/login_welcomepage/login.php"
    $testCount = 10
    $testUrl = $Url1
    while ($testCount -gt 0)
    {
        Write-host "Navigating to $testUrl"
        $IE.Navigate2($testUrl)
        While ($IE.Busy -eq $True) {Sleep -Milliseconds 500}
        $Doc = $IE.Document
        Write-host "Get Doc1: $($Doc -is [object])"
        $testCount--
    }
    
    Sleep -Milliseconds 1000
    write-host "10 times test is done, should see network trace 10 times"
    $IE.Quit()
     

    I use Fiddler to monitor the network trace. The test results show that if I use "www.google.com" ($Url1) as test URL, though IE navigates 10 times, only one load from the server, it seems that IE uses cache for the other 9 times navigate.

    But if I use my own test page ($Url2), IE actually load from server 10 times.

    So my question is:

    1. Why is this happening, is it related to the website itself?  I guess the reason is my test page is so simple that it may not contain some headers as google. 

    2. Is there any way we can enforce Navigate2 always load from the server?

    Wednesday, April 19, 2017 4:59 PM

All replies