
Untitled
By: a guest on
Aug 5th, 2012 | syntax:
None | size: 0.68 KB | hits: 12 | expires: Never
href tag doesn't open in a new webview or in mobile safari
<a ontouchstart="javascript:window.location = '../abc.html';">Click here</a>
function clearLinks()
{
var isiPad = navigator.userAgent.match(/iPad/i) != null;
if(isiPad)
{
var obj = document.getElementById('body').getElementsByTagName('a');
for(var i =0; i<obj.length; i++)
{
var url = obj[i].getAttribute('href');
if(url.indexOf("javascript")==-1)
{
obj[i].setAttribute('ontouchstart', "window.location='" + url + "'");
obj[i].setAttribute('href', 'javascript:function(){return false;}');
}
}
}
}