开发者

Stop swf file from being hotlinked

I 开发者_开发百科would like to know how I can stop other webmasters from hotlinking my flash application and using it on their websites.


The easiest way to do this is to have your web server code check the HTTP Referer header and block the download if it's not from your site. If you tell us which server-side platform you've got, we may be able to give you a more specific answer than that.


Have the flash app check the domain and if it fails to be on your domain make it redirect to your site. Let the other webmasters drive traffic to your site. :)

    import flash.net.LocalConnection;
    var lc:LocalConnection = new LocalConnection();
    switch( lc.domain ){
      case "localhost":
      case "mydomain.com"
        break;
      default:
        // do redirect here
}

I use a switch statement to detect this, because if you are testing your app and running under the local file system it will be localhost and obviously you don't want to redirect during testing

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜