IOS 8.window.location.href not working with url scheme

Hi guys I have a problem in iOS 8 and UIWebView. I run my application in webview, in this application I have an icon to call a specific url. This is the url that is registered as the app url (url scheme). Then in my UIWebView, when I click the button, another view controller should be displayed.

In iOS 7 the button works fine, I click on it and my other view controller is open. But in iOS 8, when I click the button, nothing happens. My URL handling method is never called.

the web page uses "window.location.href = MyUrlScheme: // ...", again this works fine in iOS7, but not in iOS8.

Any ideas?

Thanks a lot if someone can help me

+3


source to share


1 answer


You probably found the answer to this question, but I'll leave my solution here, it might help someone. I ran into this issue today, iOS8 UIWebView is not responding to window.location.href = "MyUrlScheme: // do-something" ...

So, I added the Iframe to the html page, set the src attribute and removed the Iframe.



var sendObjectMessage = function(parameters) {
    var iframe = document.createElement('iframe');
    iframe.setAttribute('src', "MyUrlScheme://"+parameters);
    document.documentElement.appendChild(iframe);
    iframe.parentNode.removeChild(iframe);
    iframe = null;
}

sendObjectMessage("send-something");

      

Take a look at this link https://gist.github.com/irace/3688560

+5


source







All Articles