Is there a way to make a javascript link open up in IE?

前端 未结 4 1065
无人及你
无人及你 2020-12-11 22:17

I have a link that uses javascript to submit a form, like so:

some link

4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-11 23:04

    What you can do (and I have done) is to have the link not work if the person clicking on it is not using Internet Explorer and open a new window, reveal a DIV or pop up an alert() informing them they must be using Internet Explorer for the target site to work.

    Something like:

    some link
    

    window.external.AddFavorite is (as far as I know) only available in Internet Explorer, so using it to detect IE should be fairly safe. You could also examine navigator.userAgent for MSIE, however some browsers such as Opera might spoof the IE user agent.

提交回复
热议问题