简体   繁体   English

检测IE设置:“从不”检查存储页面的较新版本

[英]Detect IE setting: check for newer versions of stored pages “never”

I understand there isn't a way to interrogate a users IE settings directly due to security reasons, but is there a way to derive this answer with some other mechanism? 我了解由于安全原因,没有办法直接询问用户的IE设置,但是有没有办法通过其他某种机制得出此答案? I would like to stop a user from using my site if the setting "Check for newer versions of stored pages" is set to "Never". 如果设置“检查存储页面的较新版本”设置为“从不”,我想阻止用户使用我的网站。 Any suggestions? 有什么建议么?

Is there a way I could test for this using javascript? 有没有一种方法可以使用javascript测试呢? An example of what I am trying to accomplish is this: While it is not possible to check IE settings to see if you are running a popup blocker, that is a way to "test" for a popup blocker via javascript. 我要完成的一个示例是: 虽然无法检查IE设置以查看您是否正在运行弹出窗口阻止程序,但这是一种通过javascript“测试”弹出窗口阻止程序的方法。 I am looking for something similiar but for the cache setting, not the popup blocker. 我正在寻找类似的东西,但需要缓存设置,而不是弹出窗口阻止程序。

Append something to the querystring that is unlikely to have been used before (a datestring, a random number). 在查询字符串上附加以前不太可能使用的内容(日期字符串,随机数)。

That will make IE 6 request the page again, as far as IE is concerned, its another page. 就IE而言,这将使IE 6再次请求页面,即其另一个页面。

So if you have http://somepage.com/dontcachethis.html you'd replace this with something like http://somepage.com/dontcachethis.html?please=23143425 where you asign please a random number. 所以,如果你有http://somepage.com/dontcachethis.html你会喜欢的东西替换此http://somepage.com/dontcachethis.html?please=23143425 ,你ASIGN please一个随机数。

Add the following to your web pages: 将以下内容添加到您的网页:

meta http-equiv="Pragma" content="no-cache"
meta http-equiv="Expires" content="0"

This forces the user's browser to reload the pages every time, regardless of the browser's cache settings. 这将强制用户的浏览器每次都重新加载页面,而不管浏览器的缓存设置如何。

I've not implemented this yet, but this is my plan: 我还没有实现,但这是我的计划:

  • Write out a date onto the page that is on an attribute of some HTML element (this should be written server side...writing it with javascript will defeat the purpose) 在页面上写出某个HTML元素的属性上的日期(这应该写在服务器端...用javascript编写会破坏目的)
  • Using javascript, load in the date. 使用javascript,加载日期。 If it is over a certain amount of time, I can assume they have not loaded a fresh copy of the page. 如果超过一定时间,我可以假定他们尚未加载该页面的新副本。 If that is the case, continue on... 如果是这样,请继续...

If I've detected that they have an old version of a page, I could do a couple things: 如果我检测到他们的页面版本较旧,则可以执行以下操作:

  1. I could warn them of this problem. 我可以警告他们这个问题。 I could show them the setting that they need to change. 我可以向他们展示他们需要更改的设置。
  2. I could redirect them to the same page but add something onto the querystring so it looks like a different page to the browser. 我可以将它们重定向到同一页面,但可以在querystring上添加一些内容,以便浏览器看起来像是另一个页面。 If I do this, I would add something in my javascript that knows about this potential redirect loop. 如果这样做,我会在JavaScript中添加一些有关此潜在重定向循环的信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM