Question by 
               SominStudios · Jul 27, 2019 at 02:54 PM · 
                webglsites  
              
 
              Sitelock for webgl
I've been strugling with this for some time now and i havent found a solution.
Basiclly i need to check what website the game is running on and if the website's not allowed then just detect that.
Ive tried to use "Application.absoluteURL" but when i test it on itch.io it gives me this really wierd url instead of the itch.io url.
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by SominStudios · Jul 28, 2019 at 02:21 PM
Solved my issue, Turns out itch.io just hosts the game on another URL. Anyways, here the script that i used for future reference :
 using UnityEngine;
 using UnityEngine.SceneManagement;
 
 public class SiteLocker : MonoBehaviour
 {
     public string[] allowedSites;
     public string redirectURL;
     public string sitelockScene;
 
     bool websiteAllowed;
 
     void Awake()
     {
         string urlPath = Application.absoluteURL.ToLower();
         Debug.Log(urlPath);  // For determining where Its hosted
         for (int i = 0; i < allowedSites.Length; i++) //Looking if any of the allowed Sites exist in the url
         {
             if (urlPath.Contains(allowedSites[i])) {
                 websiteAllowed = true;
             }
         }
 
         if (!websiteAllowed) {
             SceneManager.LoadScene(sitelockScene); //Loading a scene with a custom message
             Application.OpenURL(redirectURL); //Redirecting to the correct website
         }
     }
 }
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                