Created
May 10, 2011 14:49
-
-
Save MattMcFarland/964617 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (checkDomain(["flashgamelicense.com"])) | |
public function checkDomain (allowed:*):Boolean | |
{ | |
var url:String = FP.stage.loaderInfo.url; | |
var startCheck:int = url.indexOf('://' ) + 3; | |
trace (url); | |
//if (url.substr(0, startCheck) == 'file://') return true; | |
var domainLen:int = url.indexOf('/', startCheck) - startCheck; | |
var host:String = url.substr(startCheck, domainLen); | |
if (allowed is String) allowed = [allowed]; | |
for each (var d:String in allowed) | |
{ | |
if (host.substr(-d.length, d.length) == d) return true; | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment