Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Direct User Action and invoking window.open(link)

Discussion in 'Project Tiny' started by Michael-N3rkmind, Jan 26, 2019.

  1. Michael-N3rkmind

    Michael-N3rkmind

    Joined:
    Aug 16, 2015
    Posts:
    24
    So I've got my full website done using Unity Tiny ( Don't question why )
    And now i have to re-direct my users to different websites.

    In my code, i use window.open(URL) at the moment.
    This is upon clicking on a Button in Tiny Unity, but of course, isn't considered as a Direct User Action.

    The result is that my code goes through, but the user has to accept the pop-up first.
    Is there a way that i could hook myself to the click somehow, and run my window.open on a lower level?
     
  2. abeisgreat

    abeisgreat

    Joined:
    Nov 21, 2016
    Posts:
    44
    If you're just trying to change the page you should use
    Code (JavaScript):
    1. document.location.href = "http://example.com"
    If it really needs to be a popup you'll be in a tougher situation since browsers aggressively block them (as you described). I'm working on a tool that will help with this, but it's not ready to share yet :/
     
    Michael-N3rkmind likes this.
  3. Michael-N3rkmind

    Michael-N3rkmind

    Joined:
    Aug 16, 2015
    Posts:
    24
    Thanks Abe!

    I'll go with a redirect solution for the moment, can't wait to see your tool!