Posted By

shabbar on 03/18/10


Tagged

swf


Versions (?)

How to restrict swf to a specific url


 / Published in: ActionScript
 

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

How to restrict swf to a specific url

  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

Report this snippet  

You need to login to post a comment.