Stop swf file from being hotlinked

2019-08-30 18:33发布

I would like to know how I can stop other webmasters from hotlinking my flash application and using it on their websites.

2条回答
forever°为你锁心
2楼-- · 2019-08-30 19:15

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

查看更多
forever°为你锁心
3楼-- · 2019-08-30 19:18

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.

查看更多
登录 后发表回答