javascript - Can I determine whether clicking a link successfully opened a new window/tab? -


i have <input> element inside <a> element, meaning ie8 ignores <a> element's href attribute when clicked. works fine on other browsers. is there way determine whether new tab/window opened? can give user normal/ugly link click if didn't work.

code example:

<a target="_blank" href="http://somelink.com"><input type="button" class="standard_button_styling" /></a> 

what i've tried:

  1. remove <input> tag , style <a> tag: had trouble making other buttons (maybe due native browser styling) , don't want worse fix problem ie8.
  2. trigger link javascript window.open(): doesn't send referer_url in ie, , somelink.com in example relies on it. need have user click normal link.
  3. browser detection: ie8 , provide different response ie8, browser detection instead of feature detection regarded bad practice , i'd avoid if possible.

you can try use <button> instead of <input> not sure if solve problem.
or use <form>.

<form method="get" target="_blank" action="yourlink">     <input type="submit" value="click" /> </form> 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -