Open offline web pages in a browser window by clicking a button?
Hi all,
I currently have a game where the user can click on buttons to open up web pages, I use the following script on the button for this...
public void OpenURL(string url)
{
Application.OpenURL(url);
}
}
The URL is then put into the box that this script produces in the inspector and works perfectly.
However what I would now like to do is open the pages OFFLINE instead, so people without an internet connection can see the information. The way I envisage doing this is to save the web pages so they can be opened up locally in a browser offline. However I am stumped as to how to tell the button to open the relevant file and open it - is there a way of doing this? Maybe save the web page file in a local folder and point the button to that file?
This would be way easier that the only alternative I can think of - to save each web page as an image and have them open up as an image popup within the game as opposed to in the browser (there are a lot, so I would rather not have to do this!)
This is for PC Standalone only.
Any help would be greatly appreciated.
Thanks in advance!
Answer by NIMBLE_JIM · Mar 16, 2016 at 09:10 PM
Problem Solved -
Add a folder into the build folder and put all the files you want to be opened in there
Change the Open URL script to say
public void relativeURL(string url)
Now put 'dirname/filename' in the URL field
Hey presto - it now works!
Your answer
![](https://koobas.hobune.stream/wayback/20220612072052im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Unity - Syncing/Downloading/overwriting files to a local folder accessed by the game when offline? 0 Answers
How to display web pages in Unity? 0 Answers
Inserting game items in online database table and connect that table with the users table 0 Answers
Unity offline rendering (render to pbuffer context) 0 Answers
Cannot access asset store from unity editor. No proxy or firewall. 1 Answer