<legend id='lVJ6a'><style id='lVJ6a'><dir id='lVJ6a'><q id='lVJ6a'></q></dir></style></legend>
      <bdo id='lVJ6a'></bdo><ul id='lVJ6a'></ul>
    <i id='lVJ6a'><tr id='lVJ6a'><dt id='lVJ6a'><q id='lVJ6a'><span id='lVJ6a'><b id='lVJ6a'><form id='lVJ6a'><ins id='lVJ6a'></ins><ul id='lVJ6a'></ul><sub id='lVJ6a'></sub></form><legend id='lVJ6a'></legend><bdo id='lVJ6a'><pre id='lVJ6a'><center id='lVJ6a'></center></pre></bdo></b><th id='lVJ6a'></th></span></q></dt></tr></i><div id='lVJ6a'><tfoot id='lVJ6a'></tfoot><dl id='lVJ6a'><fieldset id='lVJ6a'></fieldset></dl></div>

      <tfoot id='lVJ6a'></tfoot>

      <small id='lVJ6a'></small><noframes id='lVJ6a'>

    1. 保护 iFrame - 只允许它在一个域上工作

      Protecting iFrame - Only allow it to work on one domain(保护 iFrame - 只允许它在一个域上工作)
        <i id='gavY8'><tr id='gavY8'><dt id='gavY8'><q id='gavY8'><span id='gavY8'><b id='gavY8'><form id='gavY8'><ins id='gavY8'></ins><ul id='gavY8'></ul><sub id='gavY8'></sub></form><legend id='gavY8'></legend><bdo id='gavY8'><pre id='gavY8'><center id='gavY8'></center></pre></bdo></b><th id='gavY8'></th></span></q></dt></tr></i><div id='gavY8'><tfoot id='gavY8'></tfoot><dl id='gavY8'><fieldset id='gavY8'></fieldset></dl></div>

          <tbody id='gavY8'></tbody>

            <bdo id='gavY8'></bdo><ul id='gavY8'></ul>
          • <small id='gavY8'></small><noframes id='gavY8'>

          • <tfoot id='gavY8'></tfoot>
                <legend id='gavY8'><style id='gavY8'><dir id='gavY8'><q id='gavY8'></q></dir></style></legend>
              1. 本文介绍了保护 iFrame - 只允许它在一个域上工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我创建了一个小部件,并使用 iFrame 将其嵌入到其他网站上.我要做的是确保没有人可以查看源代码并复制 iFrame 代码并将其放在自己的网站上.

                I have a Widget that I created and I am embedding it on other websites using an iFrame. What I want to do is make sure no one can view the source and copy the iFrame code and put it on their own website.

                我可以在数据库中存储它应该被允许的 URL.我以前见过它,一个站点有一个很长的加密代码,如果它与域不匹配,那么它会说 Access Denied..

                I can store the URL that it should be allowed on in the database. I've seen it done before, one site had a long encrypted code and if it didn't match with the domain then it said Access Denied..

                有人知道我该怎么做吗?

                Does anyone know how I can do this?

                谢谢!

                推荐答案

                不,你不能这样做.您可以做的最好的事情是:

                No you can't do this. The best thing you can do is the following:

                if (window.top.location.host != "hostname") {
                    document.body.innerHTML = "Access Denied";
                }
                

                将上述内容添加到您的 JavaScript 中,然后使用 JavaSript 混淆器

                Add the above to your JavaScript and then use a JavaSript obfuscator

                这篇关于保护 iFrame - 只允许它在一个域上工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Youtube iframe api not triggering onYouTubeIframeAPIReady(Youtube iframe api 未触发 onYouTubeIframeAPIReady)
                Embed YouTube video - Refused to display in a frame because it set #39;X-Frame-Options#39; to #39;SAMEORIGIN#39;(嵌入 YouTube 视频 - 拒绝显示在框架中,因为它将“X-Frame-Options设置为“SAMEORIGIN)
                Stop embedded youtube iframe?(停止嵌入 youtube iframe?)
                How to pause a YouTube player when hiding the iframe?(隐藏 iframe 时如何暂停 YouTube 播放器?)
                YouTube iframe player API - OnStateChange not firing(YouTube iframe 播放器 API - OnStateChange 未触发)
                YouTube iframe API: how do I control an iframe player that#39;s already in the HTML?(YouTube iframe API:如何控制 HTML 中已有的 iframe 播放器?)

                  <small id='JPYa1'></small><noframes id='JPYa1'>

                        <tbody id='JPYa1'></tbody>
                        <i id='JPYa1'><tr id='JPYa1'><dt id='JPYa1'><q id='JPYa1'><span id='JPYa1'><b id='JPYa1'><form id='JPYa1'><ins id='JPYa1'></ins><ul id='JPYa1'></ul><sub id='JPYa1'></sub></form><legend id='JPYa1'></legend><bdo id='JPYa1'><pre id='JPYa1'><center id='JPYa1'></center></pre></bdo></b><th id='JPYa1'></th></span></q></dt></tr></i><div id='JPYa1'><tfoot id='JPYa1'></tfoot><dl id='JPYa1'><fieldset id='JPYa1'></fieldset></dl></div>

                        <tfoot id='JPYa1'></tfoot>
                          <bdo id='JPYa1'></bdo><ul id='JPYa1'></ul>

                          <legend id='JPYa1'><style id='JPYa1'><dir id='JPYa1'><q id='JPYa1'></q></dir></style></legend>