Search Unity

Application.OpenURL in the Webplayer

Discussion in 'Scripting' started by rterranova, Mar 16, 2012.

  1. rterranova

    rterranova

    Joined:
    Nov 6, 2009
    Posts:
    43
    Is there a way to link to a different URL while in the web player.

    When calling Application.OpenURL() from the webplayer it replaces the webplayers URL with the one I'm trying to link too.

    Example:
    If my weblayer existed here http://www.mywebplayer.com/woot, and while running the webplayer I have a button that links to http://www.mynewlink.com. If I click that link button the webplayer would stop playing and my browser would now be linked to http://www.mynewlink.com.

    This of course works correctly in a stand alone app. But does not work correctly in the webplayer.

    Any way around this?
     
  2. SkaredCreations

    SkaredCreations

    Joined:
    Sep 29, 2010
    Posts:
    296
    It works exactly as intended, you should probably say what you want to achieve. If you want to open the url into another window/tab then you have to create a JS function in your HTML page to call with Application.ExternalCall which accept url as parameter and use window.open (could happen that the browser blocks popup, in that case you have to use a workaround like a HTML form with target _blank or simulate a link click e.g. with jQuery)
     
  3. rterranova

    rterranova

    Joined:
    Nov 6, 2009
    Posts:
    43
    Thank you for responding.

    I understand that it does function correctly, I was looking for a work around for the webplayer. I have done exactly as you said, and now am able to accomplish what I desired.

    Thanks again!
     
  4. Deleted User

    Deleted User

    Guest

    I have a code snippet here along the lines of what ZioRed suggests - http://www.fugutalk.com/?p=4096 - I think I was told that it doesn't work on every browser, but I don't remember which ones are problematic.
     
  5. Checco-Esimple

    Checco-Esimple

    Joined:
    Feb 14, 2008
    Posts:
    82
    the problem is the popup blocker
     
  6. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,347
    I am working on a hughe project for a client and also need to open an url in a new tab:

    Right- Checco Esimple - the problem is the popupblocker.

    Still, is there any solution for that popup-problem?
     
  7. BenoitFreslon

    BenoitFreslon

    Joined:
    Jan 16, 2013
    Posts:
    166
    Hello,

    Did you found a solution with the popup blocker in the web version?