- Home /
Application.OpenURL (); on webplayer to open in a new tab or "_blank"
Hi,
Within web player, the OpenUrl() is sadly lacking the option to define the Target so that we can open a new tab or a new page instead of replacing the content.
Is there a way to do that straight or should I implement this via Application.ExternalCall and write a litle function in javascript?
bye,
Jean
Answer by jonas-echterhoff · Nov 02, 2010 at 08:48 AM
There is no built-in support for this, so yes, you need to implement this using Application.ExternalCall.
here is what I use then:
Application.ExternalEval("window.open('http://your site.com','Window title')");
then you don't need any javascript function in your page for that, also setting the window title will prevent opening several time the same page if the user clicks several times.
I can use Application.ExternalEval with Flash platform. Is there any other way to do this?
Answer by Fliperamma · Oct 28, 2015 at 07:45 PM
This is terrible!
Please, vote on Unity's feedback website: https://feedback.unity3d.com/suggestions/target-parameter-for-application ... but don't rise your expectations, this suggestion is there for FIVE years now :(
Answer by forerun · Jun 11, 2020 at 09:38 AM
use the method here http://va.lent.in/opening-links-in-a-unity-webgl-project/ and add ontouchend to your jslib file, should look like this...
var OpenWindowPlugin = {
openWindow: function(link)
{
var url = Pointer_stringify(link);
document.onmouseup = function()
{
window.open("http://www.xenz.org");
document.onmouseup = null;
}
var url = Pointer_stringify(link);
document.ontouchend = function()
{
window.open("http://www.xenz.org");
document.ontouchend = null;
}
}
};
mergeInto(LibraryManager.library, OpenWindowPlugin);
always a pleasure ;)
Your answer
Follow this Question
Related Questions
Minimize MacOSX fullscreen and open URL 1 Answer
Updating txt from an url (webplayer) 0 Answers
Load image from url in Webplayer 1 Answer
Application.OpenURL() Rapid Opening 1 Answer
Open AND CLOSE webpage 1 Answer