8

Is there any way that I could tell if my site is being accessed by an instance of webbrowser control? Would it be possible to identify it by the user agent w/php? Or maybe some javascript hack? Or is it 100% identical to the regular IE from the server side?

4

2 回答 2

4

似乎将任何内容分配给window.external. 所以支票可能是这样的

const isWebBrowserControl = () => {
  try {
    window.external = window.external
    return false
  } catch (error) {
    if (error.message === 'I don\'t remember this. Some specific error message.') {
      return true
  }
}

不过,这是一个潜在的“破坏性”检查。但我真的不觉得这会造成任何问题。

于 2017-07-24T11:51:20.497 回答
3

只是一个愚蠢的想法,但你不能只是比较window.outerHeightwindow.innerHeight衡量 IE 的预期差异,如果不是,那么它的 WebBrowser 控件?

那太难了,但可以在大多数情况下工作。您还可以尝试做其他事情,这些事情可以在 IE 中以某种方式工作,但在 WebBrowser 控件中可能不起作用。

例如:

  • 下载文件
  • 打开一个新窗口/标签
于 2017-07-20T02:14:46.990 回答