iphone - Comment appeler Objective-C de Javascript

Mots clés : iphonecocoa-touchuiwebviewiphone

meilleur 3 Réponses iphone - Comment appeler Objective-C de Javascript

vote vote

98

window.location = "fake://myApp/something_happened:param1:param2:param3"; 
vote vote

89

function execute(url)  {   var iframe = document.createElement("IFRAME");   iframe.setAttribute("src", url);   document.documentElement.appendChild(iframe);   iframe.parentNode.removeChild(iframe);   iframe = null; } 
vote vote

78

window.location = "app://action/foo"; window.location = "app://action/bar"; 
waitingForMessage = false;  function MsgProcessed(){     waitingForMessage = false; }  function SyncLaunchURL(url){     if (waitingForMessage){         setTimeout(function(){SyncLaunchURL(url)},100);     }else{         window.location = url         waitingForMessage = true;        } }  SyncLaunchURL("app://action/foo"); SyncLaunchURL("app://action/bar"); 

Questions similaires