- Home /
how to make an web link?
hello
I need some help, For my game i need a menu button so when pressed it opens a web browser to my website but I dont know how to do it
Please can someone help
Thanks
Answer by sriram90 · Apr 20, 2012 at 11:45 AM
hi dalekandjedi,
here you didn't specify that which type of build you're trying with, if it's webplayer build, hope this link will help you.
http://answers.unity3d.com/questions/50138/open-link-in-new-tab-from-webplayer-hosted-on-any.html
void OnGUI ()
{
if(GUILayout.Button("Google"))
{
Application.ExternalEval("window.open('http://www.google.com', '_blank');");
}
}
it dosent work :( i would like it so it works on a 3d text and the player would be the web player
if you dont want to use GUI, you may take 3d text on a gameobject. make it click by On$$anonymous$$ouseDown() method or some otherscript. inside of that you may give that Application.ExternalEval(). try it ...
Answer by DreadKnight007 · Mar 06, 2013 at 02:46 PM
Is there a way to replace the 'http://' content with a variable and still allow the ExternalEval to work properly???
eg.
public var linkURL = "http://www.google.com";
Application.ExternalEval("window.open( linkURL, '_blank');"); ... does not work
So far I've been slightly unsucessful in overcoming this. Anyone know how to solve this issue???
Your answer
![](https://koobas.hobune.stream/wayback/20220613070540im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How do you set up a simple (single-player) web browser game? 2 Answers
How do I open a web in a VR browser from a Gear VR app? 0 Answers
Why is GetUnity not working in my HTML? 1 Answer
How would I go about getting the results of a javascript variable to a string inside script? 3 Answers
Link to another browser tab 0 Answers