Stop swf file from being hotlinked

*爱你&永不变心* 提交于 2019-12-13 05:13:58

问题


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


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/5657462/stop-swf-file-from-being-hotlinked

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!