- Home /
Place a link in another browser window.
Hi, how you could put the code to put a URL link that will load in another browser tab.
Thanks
Answer by diabloroxx · Dec 01, 2010 at 08:33 PM
Check Application.OpenURL
function Start () {
Application.OpenURL ("http://unity3d.com/");
}
Thanks, the problem is that it opens the link in the same tab.
What I seek is a link that will open in a different tab.
You can write a Javascript function on the Browser to open a url in a separate window. You can use Application.ExternalCall to call that function from Unity3d. Hope that helps. http://unity3d.com/support/documentation/ScriptReference/Application.ExternalCall.html
Answer by explrcre8 · Dec 02, 2010 at 03:19 PM
the link above to Application.ExternalCall is a good solution. For example, in your OnMouseDown function call
Application.ExternalCall ("openNewURL");
Then in the HTML call the JS function as:
<script type="text/javascript">
function openNewURL()
{
window.open('http://someURL.com', 'open_window')
}
</script>
That should do the trick. I was looking for the exact same solution to use the browser to download a .pdf from a GUIButton.
Answer by Blue Brain · Dec 02, 2010 at 12:09 AM
Thanks diabloroxx,
But I want a link _blank "(open in the next tab on the browser)
I have this:
Start function () { / / Start a download of The Given URL var www: WWW = new WWW (url);
/ / Wait for download to complete www yield;
/ / Assign texture renderer.material.mainTexture = www.texture;
}
OnMouseDown function () { Application.OpenURL (http://unity3d.com/ "); }
but it opens in the same game window.
Your answer
Follow this Question
Related Questions
Link to another browser tab 0 Answers
What would be needed for a link in browser to start Unity with the player in a specific location? 1 Answer
Game pauses when user changes browser tab (even with RunInBackground) 1 Answer
Are dockable windows possible in-game. 2 Answers
WebGL - Open URL in new tab? 10 Answers