Send JavaScript BEFORE page is shown?

Welcome! Forums Unity Plugins In-App Web Browser Send JavaScript BEFORE page is shown?

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #472
    HellsPlumber
    Participant

    Hi!

    I just wanted to ask if there’s a way to send JavaScript to the loaded page BEFORE displaying it in the webview?
    I’m using JavaScript to alter the appearance of the loaded page, but sadly people see the old appearance for a moment before the JS is applied and it suddenly changes.

    Any help would be appreciated,
    Thanks ?

    #473
    PiotrPiotr
    Keymaster

    So you are using it approach currently with a plugin? Or are you asking if it’s at least possible?

    #474
    HellsPlumber
    Participant

    Currently I’m sending JavaScript to the page via the OnBrowserFinishedLoading event.

    It goes like this:
    I load the page URL.
    The OnBrowserFinishedLoading event triggers InAppBrowser.ExecuteJS.
    The JS alters how the page looks.

    But since this is done during OnBrowserFinishedLoading, the user sees the changed to the page happen. I was hoping you’d have a way to send JS to the page to alter it’s appearance, THEN display the page afterwards.

    I’m not using any plugin, just In-App Web Browser and a JS command.

    #475
    PiotrPiotr
    Keymaster

    Wow… no, there’s no anything built in obviously. This is really rare requirement.
    What you really want is
    1. load page (but do not display it)
    2. execute your hacky script
    3. display a page

    #476
    HellsPlumber
    Participant

    I understand it’s a pretty rare requirement, I’m not complaining that it isn’t included 🙂

    And that’s correct, that’s what I need to do but I’m unsure of how to go about doing so.
    I’m fluent in C#, but sadly not in Java (where I believe the code would need to be modified).

    Would you be able to give me a hint on which part of the Jar I’d need to run my “hacky script”, and how to display it once it’s done so?

    #479
    PiotrPiotr
    Keymaster

    Hope you know it’s against Unity EULA https://unity3d.com/legal/as_terms? 🙂

    #482
    HellsPlumber
    Participant

    Which part are you talking about? 0-o
    I think you’ve misunderstood my question, I’m merely asking about JavaScript code, not breaking Unity’s EULA…

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.