Read a string from WebGL build package


How could I retrieve a string in C# script from the built WebGL package ?
I need to set an URL in the html template, or in the build JSON to avoid having this URL fixed in the build.
The url gives access to a database that would not be the same for the websites builds are hosted on, and I don’t want a specific build for each of them.

Any idea ?

An URL that gives access to a database? That already sounds like a bad design unless you mean a backend web API by database. Well the easiest solution is to use a simple text file in the streaming assets folder. You can grab this through an ordinary UnityWebRequest. Of course if you have more config options it would make more sense to use a config file in json format so you only have to grab a single file from your server and you get all the information at once.

Note: usually any sort of database access is handled through a serverside script and the client is only using the web api which is usually hosted on the same server but of course it doesn’t have to.

Thanks for the hint !
Yes the URL points to a PHP, but since it has nothing to do with my problem i did not mention it.

Yes each server has it s own backend.
The communication interface with the php scripts doesnt change but how it s implemented with the database and its path is not up to me.
My project is more a tool than a game.
But a relative URL is a good idea, i must try the Application.absoluteURL thing i read about