Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 5th, 2012  |  syntax: None  |  size: 0.68 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. href tag doesn't open in a new webview or in mobile safari
  2. <a ontouchstart="javascript:window.location = '../abc.html';">Click here</a>
  3.        
  4. function clearLinks()
  5. {
  6. var isiPad = navigator.userAgent.match(/iPad/i) != null;
  7. if(isiPad)
  8.     {
  9.     var obj = document.getElementById('body').getElementsByTagName('a');
  10.     for(var i =0; i<obj.length; i++)
  11.           {
  12.             var url = obj[i].getAttribute('href');
  13.                 if(url.indexOf("javascript")==-1)
  14.                 {
  15.                 obj[i].setAttribute('ontouchstart', "window.location='" + url + "'");
  16.                 obj[i].setAttribute('href', 'javascript:function(){return false;}');
  17.                 }
  18.             }
  19.      }
  20.  
  21. }