search

Home  >  Q&A  >  body text

javascript - Is there any more compatible way to determine the type of browser window?

Sometimes window.open will be used in the project to pop up some windows without operation options. I need a way to judge the type of these windows. I tried several properties in the picture below and found that they are not very reliable under IE. , does anyone have a better method that I can use to plagiarize?

漂亮男人漂亮男人2725 days ago659

reply all(1)I'll reply

  • 黄舟

    黄舟2017-06-20 10:08:42

    You can add an attribute to the URL to identify the window type, such as: window.open = 'test.html?type=1' Then, you only need to get this type parameter to know the window type (if If the type does not exist, jump to the default type).
    You can also see that a window will have many features, and sometimes multiple judgment conditions may need to be used, if A && B && Cetc., so I think you define these features as a set of numerical constants, Then just switch.

    reply
    0
  • Cancelreply