Advertisement
Guest User

Protecting Unity Web builds

a guest
Apr 20th, 2016
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.42 KB | None | 0 0
  1. // Check if the page is trusted
  2. bool ValidDomain()
  3. {
  4. #if UNITY_WEBGL && !UNITY_EDITOR
  5.     System.Uri uri;
  6.  
  7.     // parse the page's address
  8.     if (!System.Uri.TryCreate(Application.absoluteURL, System.UriKind.Absolute, out uri))
  9.         return false;
  10.  
  11.     // check the host
  12.     return uri.Scheme == "file" ||
  13.         uri.Host == "localhost" ||
  14.         uri.Host == "yourdomain.com" ||
  15.         uri.Host == "ludumdare.com";
  16. #else
  17.     return true;
  18. #endif
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement