{"id":69863,"date":"2005-05-06T16:17:00","date_gmt":"2005-05-06T16:17:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2005\/05\/06\/how-can-i-make-internet-explorer-check-for-a-new-version-each-time-i-visit-a-web-page\/"},"modified":"2005-05-06T16:17:00","modified_gmt":"2005-05-06T16:17:00","slug":"how-can-i-make-internet-explorer-check-for-a-new-version-each-time-i-visit-a-web-page","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/how-can-i-make-internet-explorer-check-for-a-new-version-each-time-i-visit-a-web-page\/","title":{"rendered":"How Can I Make Internet Explorer Check for a New Version Each Time I Visit a Web Page?"},"content":{"rendered":"<p><IMG class=\"nearGraphic\" title=\"Hey, Scripting Guy! Question\" border=\"0\" alt=\"Hey, Scripting Guy! Question\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" width=\"34\" height=\"34\"> \n<P>Hey, Scripting Guy! How can I make sure that Internet Explorer 6 checks for a new version on each visit to a Web page?<BR><BR>&#8212; MD<\/P><IMG border=\"0\" alt=\"Spacer\" src=\"https:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2019\/05\/spacer.gif\" width=\"5\" height=\"5\"><IMG class=\"nearGraphic\" title=\"Hey, Scripting Guy! Answer\" border=\"0\" alt=\"Hey, Scripting Guy! Answer\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" width=\"34\" height=\"34\"><A href=\"http:\/\/go.microsoft.com\/fwlink\/?linkid=68779&amp;clcid=0x409\"><IMG class=\"farGraphic\" title=\"Script Center\" border=\"0\" alt=\"Script Center\" align=\"right\" src=\"http:\/\/img.microsoft.com\/library\/media\/1033\/technet\/images\/scriptcenter\/ad.jpg\" width=\"120\" height=\"288\"><\/A> \n<P>Hey, MD. In baseball lingo we\u2019d call this a can of corn: a lazy fly ball we couldn\u2019t possibly drop. This is a tricky little question but for some strange reason we just happened to know the answer. Thus a can of corn.<\/P>\n<TABLE id=\"EYC\" class=\"dataTable\" cellSpacing=\"0\" cellPadding=\"0\">\n<THEAD><\/THEAD>\n<TBODY>\n<TR class=\"record\" vAlign=\"top\">\n<TD>\n<P>You know, you\u2019re right: maybe we <I>should<\/I> do a column on baseball lingo:<\/P>\n<P>Dear Baseball Lingo Guy! Are there any ways to describe how someone is pitching besides saying they\u2019re pitching good or they\u2019re not pitching good?<\/P>\n<P>&#8212; GS<\/P>\n<P>Hey, GS. You bet there is. If a pitcher is getting hit &#8211; and hit hard &#8211; it\u2019s likely because he\u2019s throwing meat, or maybe watermelons. If he\u2019s pitching good he might be throwing BBs or bullets. Or maybe he\u2019s just bringing it or throwing smoke. Or maybe \u2026<\/P>\n<P>OK, fine. But if you change your mind, send those baseball lingo questions to <A href=\"mailto:scripter@microsoft.com\"><B>scripter@microsoft.com (in English, if possible)<\/B><\/A>.<\/P><\/TD><\/TR><\/TBODY><\/TABLE>\n<DIV class=\"dataTableBottomMargin\"><\/DIV>\n<P>So what about our <I>scripting<\/I> question? Well, just to make sure we\u2019re all on the same page here, we\u2019re talking about one of the Internet Explorer <B>Temporary Internet Files<\/B> settings. To access this through the Internet Explorer UI, click <B>Tools<\/B>, click <B>Internet Options<\/B>, and then, in the <B>Internet Options<\/B> dialog box, click <B>Settings<\/B>. You should see a dialog box that looks like this:<\/P><IMG border=\"0\" alt=\"Internet Explorer\" src=\"http:\/\/img.microsoft.com\/library\/media\/1033\/technet\/images\/scriptcenter\/qanda\/iecheck.jpg\" width=\"354\" height=\"357\"> \n<P><BR>We\u2019re talking about the four radio buttons at the top, the ones specifying when (or if) Internet Explorer will check for newer versions of cached Web pages.<\/P>\n<P>So how can we script this? Well, it turns out that the setting for these radio buttons is stored in the registry, although in a somewhat less than intuitive location: HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\SyncMode5. If you change the value of <B>SyncMode5<\/B>, you\u2019ll change the behavior of Internet Explorer when it comes to checking for new versions of stored pages. SyncMode5 can be set to one of four different values:<\/P>\n<TABLE id=\"ERE\" class=\"dataTable\" cellSpacing=\"0\" cellPadding=\"0\">\n<THEAD><\/THEAD>\n<TBODY>\n<TR class=\"record\" vAlign=\"top\">\n<TD>\n<P class=\"lastInCell\"><B>Setting<\/B><\/P><\/TD>\n<TD>\n<P class=\"lastInCell\"><B>Value<\/B><\/P><\/TD><\/TR>\n<TR class=\"evenRecord\" vAlign=\"top\">\n<TD>\n<P class=\"lastInCell\">Every visit to the page<\/P><\/TD>\n<TD>\n<P class=\"lastInCell\">3<\/P><\/TD><\/TR>\n<TR class=\"record\" vAlign=\"top\">\n<TD>\n<P class=\"lastInCell\">Every time you start Internet Explorer<\/P><\/TD>\n<TD>\n<P class=\"lastInCell\">2<\/P><\/TD><\/TR>\n<TR class=\"evenRecord\" vAlign=\"top\">\n<TD>\n<P class=\"lastInCell\">Automatically<\/P><\/TD>\n<TD>\n<P class=\"lastInCell\">4<\/P><\/TD><\/TR>\n<TR class=\"record\" vAlign=\"top\">\n<TD>\n<P class=\"lastInCell\">Never<\/P><\/TD>\n<TD>\n<P class=\"lastInCell\">0<\/P><\/TD><\/TR><\/TBODY><\/TABLE>\n<DIV class=\"dataTableBottomMargin\"><\/DIV>\n<P>And because this is a simple DWORD registry value we can modify the setting (on remote computers as well as on the local computer) by using a WMI script just like this one:<\/P><PRE class=\"codeSample\">Const HKEY_CURRENT_USER = &amp;H80000001<\/p>\n<p>strComputer = &#8220;.&#8221;\nSet objRegistry = GetObject(&#8220;winmgmts:\\\\&#8221; &amp; strComputer &amp; &#8220;\\root\\default:StdRegProv&#8221;)<\/p>\n<p>strKeyPath = &#8220;SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings&#8221;\nstrValueName = &#8220;SyncMode5&#8221;\ndwValue = 3\nobjRegistry.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, strValueName, dwValue\n<\/PRE>\n<P>The script begins by defining a constant named HKEY_CURRENT_USER and setting the value to &amp;H80000001; we\u2019ll use this later on to tell WMI that we want to work with the HKEY_CURRENT_USER portion of the registry. We then connect to the WMI service on the local computer; we could also connect to the WMI service on a remote machine simply by assigning the name of that computer to the variable strComputer. Note that the WMI class we need to use &#8211; <B>StdRegProv<\/B> &#8211; is found in the <B>root\\default<\/B> namespace. In comparison, most WMI system administration scripts use classes found in the root\\cimv2 namespace.<\/P>\n<P>We then assign values to three variables:<\/P>\n<TABLE border=\"0\" cellSpacing=\"0\" cellPadding=\"0\">\n<TBODY>\n<TR>\n<TD class=\"listBullet\" vAlign=\"top\">\u2022<\/TD>\n<TD class=\"listItem\">\n<P><B>strKeyPath<\/B>, which is assigned the path to the registry key where SyncMode5 lives.<\/P><\/TD><\/TR>\n<TR>\n<TD class=\"listBullet\" vAlign=\"top\">\u2022<\/TD>\n<TD class=\"listItem\">\n<P><B>strValueName<\/B>, which is assigned the name of our target registry value (SyncMode5).<\/P><\/TD><\/TR>\n<TR>\n<TD class=\"listBullet\" vAlign=\"top\">\u2022<\/TD>\n<TD class=\"listItem\">\n<P><B>dwValue<\/B>, which is assigned the value <B>3<\/B>. As we\u2019ve already seen, if SyncMode5 is set to 3, then Internet Explorer will be configured to check for a newer version each time it visits a page.<\/P><\/TD><\/TR><\/TBODY><\/TABLE>\n<P>From there we simply call the <B>SetDWORDValue<\/B> method, passing the appropriate constants and variables, and thus configuring Internet Explorer to check for a newer version each time it visits a page.<\/P>\n<P>Like we also say in the baseball world, you can put this one in the book.<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hey, Scripting Guy! How can I make sure that Internet Explorer 6 checks for a new version on each visit to a Web page?&#8212; MD Hey, MD. In baseball lingo we\u2019d call this a can of corn: a lazy fly ball we couldn\u2019t possibly drop. This is a tricky little question but for some strange [&hellip;]<\/p>\n","protected":false},"author":595,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[17,31,26,3,167,5],"class_list":["post-69863","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-internet-explorer","tag-operating-system","tag-registry","tag-scripting-guy","tag-using-the-internet","tag-vbscript"],"acf":[],"blog_post_summary":"<p>Hey, Scripting Guy! How can I make sure that Internet Explorer 6 checks for a new version on each visit to a Web page?&#8212; MD Hey, MD. In baseball lingo we\u2019d call this a can of corn: a lazy fly ball we couldn\u2019t possibly drop. This is a tricky little question but for some strange [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/69863","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/595"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=69863"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/69863\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=69863"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=69863"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=69863"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}