Skip to main content
added 23 characters in body
Source Link
Mołot
  • 21.9k
  • 8
  • 59
  • 112

You can't apply JS only to one browser using Drupal functions. What you can do is:

  • CSS workaround:

    • apply CSS only to IE
    • assign some style that will not be visible, but also will not be present in non-IE, like white 1px border on white background
    • use css() jQuery method to test if element has property you expect it to have in IE, and if true, execute your code.
  • JavaScript way: Use jQuery Browser Plugin or similar solution to identify browser inside your js file. Execute your code if it's the browser you need it executed in.

You can't apply JS only to one browser. What you can do is:

  • CSS workaround:

    • apply CSS only to IE
    • assign some style that will not be visible, but also will not be present in non-IE, like white 1px border on white background
    • use css() jQuery method to test if element has property you expect it to have in IE, and if true, execute your code.
  • JavaScript way: Use jQuery Browser Plugin or similar solution to identify browser inside your js file. Execute your code if it's the browser you need it executed in.

You can't apply JS only to one browser using Drupal functions. What you can do is:

  • CSS workaround:

    • apply CSS only to IE
    • assign some style that will not be visible, but also will not be present in non-IE, like white 1px border on white background
    • use css() jQuery method to test if element has property you expect it to have in IE, and if true, execute your code.
  • JavaScript way: Use jQuery Browser Plugin or similar solution to identify browser inside your js file. Execute your code if it's the browser you need it executed in.

Source Link
Mołot
  • 21.9k
  • 8
  • 59
  • 112

You can't apply JS only to one browser. What you can do is:

  • CSS workaround:

    • apply CSS only to IE
    • assign some style that will not be visible, but also will not be present in non-IE, like white 1px border on white background
    • use css() jQuery method to test if element has property you expect it to have in IE, and if true, execute your code.
  • JavaScript way: Use jQuery Browser Plugin or similar solution to identify browser inside your js file. Execute your code if it's the browser you need it executed in.