iPad webapp links open in new tab from area href (imagemap)

129 Views Asked by At

I have an ipad webapp that I have a slight issue with in that links from an imagemap are opening in a new tab. I have utilised some great code for opening links in a webapp and it works great with <a href='#'> tags but it doesn't seem to work with <area href='#'> tags.

Here is the code:

(function(a,b,c){if(c in b&&b[c]){var d,e=a.location,f=/^(a|html)$/i;a.addEventListener("click",function(a){d=a.target;while(!f.test(d.nodeName))d=d.parentNode;"href"in d&&(d.href.indexOf("http")||~d.href.indexOf(e.host))&&(a.preventDefault(),e.href=d.href)},!1)}})(document,window.navigator,"standalone")

Does anyone know how to tweak this code to make area href tags open without breaking into a new tab?

0

There are 0 best solutions below