How to restrict swf to a specific url


/ Published in: ActionScript
Save to your folder(s)

How to restrict swf to a specific url


Copy this code and paste it in your HTML
  1. isStolen = function (ourDomainName) {
  2. var protocol, urlString, part1, part2, part3, part4, domain;
  3. //Get the current url
  4. urlString = _root._url;
  5. protocol = urlString.substr(0, urlString.indexOf(":"));
  6. //if we are on the internet.. do the check
  7. if (protocol == "http") {
  8. /*get everything between the "://"
  9. and the next "/"*/
  10. part1 = urlString.indexOf("://")+3;
  11. part2 = urlString.indexOf("/", part1);
  12. domain = urlString.substring(part1, part2);
  13. //throw away any prefixes of "."
  14. part3 = domain.lastIndexOf(".")-1;
  15. part4 = domain.lastIndexOf(".", part3)+1;
  16. domain = domain.substring(part4, domain.length);
  17. //Do the right thing!
  18. if (domain != ourDomainName) {
  19. return (true);
  20. }
  21. //End if
  22. }
  23. //End if
  24. };//End function
  25.  
  26. //Do a check for theives..send them to your page
  27. if (isStolen("thevirtualdesign.com")) {
  28. getURL("http://thevirtualdesign.com/");
  29. return;
  30. } else {
  31. delete (isStolen);
  32. }//End if

URL: http://webxadmin.free.fr/article/how-to-restrict-swf-to-specific-url-458.php

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.