But is it possible to get what "document.location" is equal inside my scripts? Ideally it would be without modifying the page itself that the unity web player is embedded in.
try Application.dataPath it doesn't return the exact html file, but it does return the path. If you're going for antipiracy this should be enough. For example:
if (Application.platform == RuntimePlatform.WindowsWebPlayer || Application.platform == RuntimePlatform.OSXWebPlayer)
{
datapath = Application.dataPath;
if(datapath == "http://mypage.com/games/mygame")
{
print("This is the correct page. No piracy detected.");
}
else
{
print("Dr Jones: This game doesn't belong on this webpage. It BELONGS IN A MUSEUM!
Auctioneer:SIT DOWN Dr Jones!");
}
}
Check out the Unity function Application.absoluteURL. The Scripting Reference for that function also has an anti-piracy code sample using that and Application.dataPath.