<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 - 只允许它在一个域上工作

      时间:2023-09-07
        <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 - 只允许它在一个域上工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:创建 OpenID 登录小部件 下一篇:用于 Twitter 小部件宽度的 HTML/CSS

                相关文章

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

                  1. <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>