How can I prevent [removed] from being triggered by [removed] href links in IE?

前端 未结 6 1658
清酒与你
清酒与你 2021-01-30 05:24

I\'m building a fail safe for my form that is going to warn users that if they leave the page their form data will be lost (similar to what gmail does).

window.         


        
6条回答
  •  醉梦人生
    2021-01-30 06:22

    If you include a bookmark symbol in the href of the a tag you should be able to still use the onclick event to include your JavaScript.

    click
    

    I’ve run a number of tests and this appears to execute the JavaScript without triggering the onbeforeunload event. I’d be curious to know if this works for others or if you still have the same problem after implementing a tags in this manner.

提交回复
热议问题