onJSMessage shows wrong value and doesn't work on iOS

Welcome! Forums Unity Plugins In-App Web Browser onJSMessage shows wrong value and doesn't work on iOS

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #424
    trueicecold
    Participant

    Hey there,

    I’m using the JS code supplied in the PDF, and the bridge supplied with the plugin to open urls from the inline browser to and external one.

    I’m passing a url to the “sendMessageToUnity” function:

    
    sendMessageToUnity('https://www.google.com');
    

    and open it in an external browser:

    
    void OnMessageFromJS(string jsMessage) {
        Application.openURL(jsMessage)
    }
    

    it works perfectly fine on Android, but it doesn’t with iOS. I see a debug message from onJSMessage, but it shows the https without the “:”

    https//www.google.com

    is this only a bug in the loggins? and if so, any reason why it doesn’t open a new browser on iOS?

    Thanks!

    #425
    PiotrPiotr
    Keymaster

    Hi,
    I think you need to do URL encoding first, so it becomes https%3A%2F%2Fwww.google.com.

    #427
    trueicecold
    Participant

    Thanks Piotr, that did the trick.
    Had to add it only to iOS, since Android failed with this one 🙂

    • This reply was modified 6 years, 5 months ago by trueicecold.
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.