{"id":41312,"date":"2025-06-01T08:11:02","date_gmt":"2025-06-01T00:11:02","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/41312.html"},"modified":"2025-06-01T08:11:02","modified_gmt":"2025-06-01T00:11:02","slug":"%e5%a6%82%e4%bd%95%e6%a3%80%e6%b5%8b%e7%bd%91%e9%a1%b5%e6%98%af%e5%90%a6%e8%a2%ab%e5%a4%96%e9%83%a8iframe%e5%b5%8c%e5%85%a5%ef%bc%9f%e4%bb%8e%e5%89%8d%e7%ab%af%e6%a3%80%e6%b5%8b%e5%88%b0%e6%9c%8d","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/41312.html","title":{"rendered":"\u5982\u4f55\u68c0\u6d4b\u7f51\u9875\u662f\u5426\u88ab\u5916\u90e8iframe\u5d4c\u5165\uff1f\u4ece\u524d\u7aef\u68c0\u6d4b\u5230\u670d\u52a1\u5668\u9632\u62a4\u7684\u5b8c\u6574\u65b9\u6848"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250601001059-683b9a939f8bd.png\" alt=\"iframe\u5d4c\u5165\" \/><\/p>\n<h2>\u5982\u4f55\u68c0\u6d4b\u7f51\u9875\u662f\u5426\u88ab\u5916\u90e8iframe\u5d4c\u5165&#xff1f;\u4ece\u524d\u7aef\u68c0\u6d4b\u5230\u670d\u52a1\u5668\u9632\u62a4\u7684\u5b8c\u6574\u65b9\u6848<\/h2>\n<\/p>\n<h4>\u6587\u7ae0\u76ee\u5f55<\/h4>\n<ul>\n<li>\u5982\u4f55\u68c0\u6d4b\u7f51\u9875\u662f\u5426\u88ab\u5916\u90e8iframe\u5d4c\u5165&#xff1f;\u4ece\u524d\u7aef\u68c0\u6d4b\u5230\u670d\u52a1\u5668\u9632\u62a4\u7684\u5b8c\u6574\u65b9\u6848<\/li>\n<li>\n<ul>\n<li>\u4e00\u3001\u4e3a\u4ec0\u4e48\u9700\u8981\u68c0\u6d4biframe\u5d4c\u5165&#xff1f;<\/li>\n<li>\n<ul>\n<li>1. \u6838\u5fc3\u98ce\u9669\u4e0e\u75db\u70b9<\/li>\n<li>2. \u5178\u578b\u5e94\u7528\u573a\u666f<\/li>\n<\/ul>\n<\/li>\n<li>\u4e8c\u3001\u524d\u7aef\u68c0\u6d4b\u6838\u5fc3\u539f\u7406\u4e0e\u4ee3\u7801\u5b9e\u73b0<\/li>\n<li>\n<ul>\n<li>1. \u68c0\u6d4b\u6838\u5fc3\u903b\u8f91<\/li>\n<li>2. \u5b8c\u6574\u63d0\u793a\u7ec4\u4ef6\u5b9e\u73b0<\/li>\n<li>3. \u529f\u80fd\u7279\u6027\u89e3\u6790<\/li>\n<\/ul>\n<\/li>\n<li>\u4e09\u3001\u65b9\u6848\u4f18\u7f3a\u70b9\u5bf9\u6bd4<\/li>\n<li>\n<ul>\n<li>\u7279\u6b8a\u573a\u666f\u5904\u7406<\/li>\n<\/ul>\n<\/li>\n<li>\u56db\u3001\u670d\u52a1\u5668\u5c42\u9762\u7684\u5f3a\u5316\u9632\u62a4\u7b56\u7565<\/li>\n<li>\n<ul>\n<li>1. \u63a8\u8350\u65b9\u6848&#xff1a;\u4f7f\u7528HTTP\u5b89\u5168\u5934<\/li>\n<li>\n<ul>\n<li>&#xff08;1&#xff09;X-Frame-Options\u5934&#xff08;\u65e7\u7248\u65b9\u6848&#xff09;<\/li>\n<li>&#xff08;2&#xff09;Content-Security-Policy\u5934&#xff08;\u63a8\u8350\u65b9\u6848&#xff09;<\/li>\n<\/ul>\n<\/li>\n<li>2. \u4e24\u79cd\u65b9\u6848\u5bf9\u6bd4<\/li>\n<li>3. \u914d\u7f6e\u6ce8\u610f\u4e8b\u9879<\/li>\n<\/ul>\n<\/li>\n<li>\u4e94\u3001\u8fdb\u9636\u4f18\u5316\u65b9\u6848<\/li>\n<li>\n<ul>\n<li>1. \u52a8\u6001\u767d\u540d\u5355\u673a\u5236<\/li>\n<li>2. \u54cd\u5e94\u5f0f\u6837\u5f0f\u4f18\u5316<\/li>\n<li>3. \u7ed3\u5408Post-Message\u901a\u4fe1<\/li>\n<\/ul>\n<\/li>\n<li>\u516d\u3001\u6700\u4f73\u5b9e\u8df5\u5efa\u8bae<\/li>\n<li>\u7ed3\u8bed<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p> \u5728Web\u5f00\u53d1\u4e2d&#xff0c;\u6211\u4eec\u6709\u65f6\u4f1a\u9047\u5230\u9875\u9762\u5185\u5bb9\u88ab\u672a\u7ecf\u6388\u6743\u7684\u7f51\u7ad9\u901a\u8fc7<br \/>\n&lt;iframe&gt;\u5d4c\u5165\u7684\u60c5\u51b5\u3002\u8fd9\u79cd\u884c\u4e3a\u53ef\u80fd\u5bfc\u81f4\u7528\u6237\u4f53\u9a8c\u4e0b\u964d&#xff08;\u5982\u5e03\u5c40\u5f02\u5e38\u3001\u529f\u80fd\u53d7\u9650&#xff09;&#xff0c;\u751a\u81f3\u5f15\u53d1\u5b89\u5168\u98ce\u9669&#xff08;\u5982\u70b9\u51fb\u52ab\u6301\u653b\u51fb&#xff09;\u3002\u672c\u6587\u5c06\u4ece\u524d\u7aef\u68c0\u6d4b\u539f\u7406\u3001\u4ee3\u7801\u5b9e\u73b0\u3001\u670d\u52a1\u5668\u9632\u62a4\u7b56\u7565\u7b49\u7ef4\u5ea6&#xff0c;\u63d0\u4f9b\u4e00\u5957\u5b8c\u6574\u7684\u89e3\u51b3\u65b9\u6848\u3002 <\/p>\n<h3>\u4e00\u3001\u4e3a\u4ec0\u4e48\u9700\u8981\u68c0\u6d4biframe\u5d4c\u5165&#xff1f;<\/h3>\n<h4>1. \u6838\u5fc3\u98ce\u9669\u4e0e\u75db\u70b9<\/h4>\n<ul>\n<li>\u7528\u6237\u4f53\u9a8c\u53d7\u635f&#xff1a;iframe\u73af\u5883\u53ef\u80fd\u5bfc\u81f4\u5f39\u7a97\u88ab\u62e6\u622a\u3001Cookie\u8de8\u57df\u9650\u5236\u3001\u9875\u9762\u6eda\u52a8\u6761\u53cc\u91cd\u663e\u793a\u7b49\u95ee\u9898<\/li>\n<li>\u6d41\u91cf\u52ab\u6301\u98ce\u9669&#xff1a;\u6076\u610f\u7ad9\u70b9\u53ef\u80fd\u901a\u8fc7\u5d4c\u5957\u9875\u9762\u7a83\u53d6\u7528\u6237\u6ce8\u610f\u529b&#xff0c;\u5f71\u54cd\u539f\u59cb\u7ad9\u70b9\u7684\u6d41\u91cf\u7edf\u8ba1<\/li>\n<li>\u5b89\u5168\u5a01\u80c1\u5347\u7ea7&#xff1a;\u7ecf\u5178\u7684\u70b9\u51fb\u52ab\u6301\u653b\u51fb&#xff08;Clickjacking&#xff09;\u6b63\u662f\u5229\u7528iframe\u5d4c\u5957\u5b9e\u73b0\u89c6\u89c9\u6b3a\u9a97<\/li>\n<\/ul>\n<h4>2. \u5178\u578b\u5e94\u7528\u573a\u666f<\/h4>\n<ul>\n<li>\u5185\u5bb9\u578b\u7f51\u7ad9&#xff08;\u5982\u65b0\u95fb\u3001\u535a\u5ba2&#xff09;\u9632\u6b62\u5185\u5bb9\u88ab\u975e\u6cd5\u805a\u5408\u5e73\u53f0\u5d4c\u5957<\/li>\n<li>\u91d1\u878d\/\u652f\u4ed8\u7c7b\u7ad9\u70b9\u9632\u8303\u9493\u9c7c\u653b\u51fb<\/li>\n<li>\u9700\u4e25\u683c\u63a7\u5236\u8bbf\u95ee\u5165\u53e3\u7684\u4f01\u4e1a\u5185\u90e8\u7cfb\u7edf<\/li>\n<\/ul>\n<h3>\u4e8c\u3001\u524d\u7aef\u68c0\u6d4b\u6838\u5fc3\u539f\u7406\u4e0e\u4ee3\u7801\u5b9e\u73b0<\/h3>\n<h4>1. \u68c0\u6d4b\u6838\u5fc3\u903b\u8f91<\/h4>\n<p><span class=\"token comment\">\/\/ \u5224\u65ad\u5f53\u524d\u7a97\u53e3\u662f\u5426\u4e3a\u9876\u7ea7\u7a97\u53e3<\/span><br \/>\n<span class=\"token keyword\">const<\/span> isInIframe <span class=\"token operator\">&#061;<\/span> window<span class=\"token punctuation\">.<\/span>top <span class=\"token operator\">!&#061;&#061;<\/span> window<span class=\"token punctuation\">.<\/span>self<span class=\"token punctuation\">;<\/span><\/p>\n<ul>\n<li>window.self&#xff1a;\u6307\u5411\u5f53\u524d\u7a97\u53e3\u81ea\u8eab<\/li>\n<li>window.top&#xff1a;\u6307\u5411\u6700\u9876\u5c42\u7684\u6d4f\u89c8\u4e0a\u4e0b\u6587&#xff08;\u82e5\u5f53\u524d\u7a97\u53e3\u662fiframe&#xff0c;top\u6307\u5411\u7236\u7a97\u53e3&#xff1b;\u5426\u5219\u7b49\u4e8eself&#xff09;<\/li>\n<li>\u5f53top !&#061;&#061; self\u65f6&#xff0c;\u8bf4\u660e\u5f53\u524d\u9875\u9762\u6b63\u88ab\u67d0\u4e2a\u4e0a\u5c42\u6846\u67b6\u5d4c\u5957<\/li>\n<\/ul>\n<h4>2. \u5b8c\u6574\u63d0\u793a\u7ec4\u4ef6\u5b9e\u73b0<\/h4>\n<p><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;<\/span>script<\/span><span class=\"token punctuation\">&gt;<\/span><\/span><span class=\"token script\"><span class=\"token language-javascript\"><br \/>\n<span class=\"token keyword\">function<\/span> <span class=\"token function\">showIframeWarning<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">const<\/span> warningDiv <span class=\"token operator\">&#061;<\/span> document<span class=\"token punctuation\">.<\/span><span class=\"token function\">createElement<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;div&#039;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    warningDiv<span class=\"token punctuation\">.<\/span>style<span class=\"token punctuation\">.<\/span>cssText <span class=\"token operator\">&#061;<\/span> <span class=\"token template-string\"><span class=\"token template-punctuation string\">&#096;<\/span><span class=\"token string\"><br \/>\n        position: fixed;<br \/>\n        top: 0;<br \/>\n        left: 0;<br \/>\n        width: 100%;<br \/>\n        padding: 20px;<br \/>\n        background-color: #f8d7da;<br \/>\n        border-bottom: 1px solid #dc3545;<br \/>\n        font-family: &#039;Segoe UI&#039;, sans-serif;<br \/>\n        z-index: 999999;<br \/>\n    <\/span><span class=\"token template-punctuation string\">&#096;<\/span><\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token keyword\">const<\/span> message <span class=\"token operator\">&#061;<\/span> <span class=\"token template-string\"><span class=\"token template-punctuation string\">&#096;<\/span><span class=\"token string\"><br \/>\n        &lt;h3 style&#061;&#034;color: #721c24; margin: 0;&#034;&gt;\u6ce8\u610f&#xff1a;\u5f53\u524d\u6d4f\u89c8\u73af\u5883\u5f02\u5e38&lt;\/h3&gt;<br \/>\n        &lt;p style&#061;&#034;color: #6c757d; margin: 10px 0;&#034;&gt;\u60a8\u6b63\u5728\u901a\u8fc7\u6846\u67b6\u5d4c\u5957\u8bbf\u95ee\u672c\u9875\u9762&#xff0c;\u90e8\u5206\u529f\u80fd\u53ef\u80fd\u65e0\u6cd5\u6b63\u5e38\u4f7f\u7528\u3002&lt;\/p&gt;<br \/>\n        &lt;a href&#061;&#034;<\/span><span class=\"token interpolation\"><span class=\"token interpolation-punctuation punctuation\">${<\/span>window<span class=\"token punctuation\">.<\/span>self<span class=\"token punctuation\">.<\/span>location<span class=\"token interpolation-punctuation punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<br \/>\n           target&#061;&#034;_blank&#034;<br \/>\n           style&#061;&#034;display: inline-block;<br \/>\n                  padding: 10px 20px;<br \/>\n                  background-color: #dc3545;<br \/>\n                  color: white;<br \/>\n                  text-decoration: none;<br \/>\n                  border-radius: 4px;<br \/>\n                  margin-top: 15px;&#034;<br \/>\n        &gt;\u70b9\u51fb\u76f4\u63a5\u8bbf\u95ee\u672c\u9875\u9762&lt;\/a&gt;<br \/>\n    <\/span><span class=\"token template-punctuation string\">&#096;<\/span><\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    warningDiv<span class=\"token punctuation\">.<\/span>innerHTML <span class=\"token operator\">&#061;<\/span> message<span class=\"token punctuation\">;<\/span><br \/>\n    document<span class=\"token punctuation\">.<\/span>body<span class=\"token punctuation\">.<\/span><span class=\"token function\">prepend<\/span><span class=\"token punctuation\">(<\/span>warningDiv<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u6267\u884c\u68c0\u6d4b<\/span><br \/>\n<span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>window<span class=\"token punctuation\">.<\/span>top <span class=\"token operator\">!&#061;&#061;<\/span> window<span class=\"token punctuation\">.<\/span>self<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token function\">showIframeWarning<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\n<\/span><\/span><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;\/<\/span>script<\/span><span class=\"token punctuation\">&gt;<\/span><\/span><\/p>\n<h4>3. \u529f\u80fd\u7279\u6027\u89e3\u6790<\/h4>\n<ul>\n<li>\u89c6\u89c9\u8bbe\u8ba1&#xff1a;\u91c7\u7528Bootstrap\u98ce\u683c\u7684\u8b66\u544a\u6837\u5f0f&#xff0c;\u7ea2\u8272\u7cfb\u914d\u8272&#xff08;#f8d7da\u80cc\u666f&#xff0c;#dc3545\u5f3a\u8c03\u8272&#xff09;\u7b26\u5408\u8b66\u793a\u4fe1\u606f\u89c4\u8303<\/li>\n<li>\u4ea4\u4e92\u8bbe\u8ba1&#xff1a;\n<ul>\n<li>\u56fa\u5b9a\u5b9a\u4f4d\u786e\u4fdd\u59cb\u7ec8\u663e\u793a\u5728\u9875\u9762\u9876\u90e8<\/li>\n<li>\u8df3\u8f6c\u94fe\u63a5\u4f7f\u7528target&#061;&#034;_blank&#034;\u907f\u514d\u8986\u76d6\u5f53\u524diframe<\/li>\n<li>z-index\u8bbe\u7f6e\u4e3a999999\u4fdd\u8bc1\u5c42\u7ea7\u6700\u9ad8<\/li>\n<\/ul>\n<\/li>\n<li>\u517c\u5bb9\u6027&#xff1a;\u652f\u6301\u73b0\u4ee3\u6d4f\u89c8\u5668&#xff08;Chrome, Firefox, Edge, Safari&#xff09;&#xff0c;IE11\u9700\u8865\u5145URL\u5bf9\u8c61 polyfill<\/li>\n<\/ul>\n<h3>\u4e09\u3001\u65b9\u6848\u4f18\u7f3a\u70b9\u5bf9\u6bd4<\/h3>\n<table>\n<tr>\u4f18\u52bf\u5c40\u9650\u6027<\/tr>\n<tbody>\n<tr>\n<td>\u5feb\u901f\u5b9e\u73b0<\/td>\n<td>\u65e0\u6cd5\u963b\u6b62\u5d4c\u5165\u884c\u4e3a<\/td>\n<\/tr>\n<tr>\n<td>\u7528\u6237\u5f15\u5bfc\u660e\u786e<\/td>\n<td>\u4f9d\u8d56JavaScript\u6267\u884c<\/td>\n<\/tr>\n<tr>\n<td>\u53ef\u81ea\u5b9a\u4e49\u6837\u5f0f<\/td>\n<td>\u68c0\u6d4b\u5b58\u5728\u4f8b\u5916\u60c5\u51b5<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>\u7279\u6b8a\u573a\u666f\u5904\u7406<\/h4>\n<li>iframe\u540c\u6e90\u573a\u666f&#xff1a;\u5f53\u7236\u9875\u9762\u4e0e\u5f53\u524d\u9875\u9762\u540c\u6e90\u65f6&#xff08;\u5982\u540c\u4e00\u57df\u540d\u7684\u4e0d\u540c\u5b50\u8def\u5f84&#xff09;&#xff0c;\u53ef\u6dfb\u52a0\u989d\u5916\u5224\u65ad&#xff1a;<\/li>\n<p><span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>window<span class=\"token punctuation\">.<\/span>top <span class=\"token operator\">!&#061;&#061;<\/span> window<span class=\"token punctuation\">.<\/span>self <span class=\"token operator\">&amp;&amp;<\/span> window<span class=\"token punctuation\">.<\/span>top<span class=\"token punctuation\">.<\/span>location<span class=\"token punctuation\">.<\/span>origin <span class=\"token operator\">!&#061;&#061;<\/span> window<span class=\"token punctuation\">.<\/span>location<span class=\"token punctuation\">.<\/span>origin<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token function\">showIframeWarning<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<li>\u591a\u5c42\u5d4c\u5957\u68c0\u6d4b&#xff1a;window.top\u59cb\u7ec8\u6307\u5411\u6700\u9876\u5c42\u7a97\u53e3&#xff0c;\u65e0\u9700\u62c5\u5fc3\u591a\u5c42iframe\u5d4c\u5957\u7684\u68c0\u6d4b\u95ee\u9898<\/li>\n<h3>\u56db\u3001\u670d\u52a1\u5668\u5c42\u9762\u7684\u5f3a\u5316\u9632\u62a4\u7b56\u7565<\/h3>\n<h4>1. \u63a8\u8350\u65b9\u6848&#xff1a;\u4f7f\u7528HTTP\u5b89\u5168\u5934<\/h4>\n<h5>&#xff08;1&#xff09;X-Frame-Options\u5934&#xff08;\u65e7\u7248\u65b9\u6848&#xff09;<\/h5>\n<p># Nginx\u914d\u7f6e\u793a\u4f8b<br \/>\nadd_header X-Frame-Options DENY;       # \u7981\u6b62\u4efb\u4f55\u6846\u67b6\u5d4c\u5165<br \/>\n# add_header X-Frame-Options SAMEORIGIN;  # \u4ec5\u5141\u8bb8\u540c\u6e90\u6846\u67b6\u5d4c\u5165<\/p>\n<h5>&#xff08;2&#xff09;Content-Security-Policy\u5934&#xff08;\u63a8\u8350\u65b9\u6848&#xff09;<\/h5>\n<p># \u5b8c\u5168\u7981\u6b62\u5d4c\u5165<br \/>\nadd_header Content-Security-Policy &#034;frame-ancestors &#039;none&#039;&#034;;<\/p>\n<p># \u5141\u8bb8\u6307\u5b9a\u57df\u540d\u5d4c\u5165&#xff08;\u652f\u6301\u901a\u914d\u7b26&#xff09;<br \/>\nadd_header Content-Security-Policy &#034;frame-ancestors https:\/\/trusted.com https:\/\/*.allowed.com&#034;;<\/p>\n<p># \u5141\u8bb8\u540c\u6e90\u53ca\u5b50\u57df\u540d\u5d4c\u5165<br \/>\nadd_header Content-Security-Policy &#034;frame-ancestors &#039;self&#039; https:\/\/*.yourdomain.com&#034;;<\/p>\n<h4>2. \u4e24\u79cd\u65b9\u6848\u5bf9\u6bd4<\/h4>\n<table>\n<tr>\u7279\u6027X-Frame-OptionsContent-Security-Policy<\/tr>\n<tbody>\n<tr>\n<td>\u6d4f\u89c8\u5668\u652f\u6301<\/td>\n<td>\u5168\u517c\u5bb9&#xff08;IE8&#043;&#xff09;<\/td>\n<td>\u73b0\u4ee3\u6d4f\u89c8\u5668&#xff08;IE\u4e0d\u652f\u6301&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u529f\u80fd\u4e30\u5bcc\u5ea6<\/td>\n<td>\u57fa\u7840\u63a7\u5236<\/td>\n<td>\u652f\u6301\u590d\u6742\u7b56\u7565<\/td>\n<\/tr>\n<tr>\n<td>\u63a8\u8350\u7a0b\u5ea6<\/td>\n<td>\u8fc7\u6e21\u65b9\u6848<\/td>\n<td>\u73b0\u4ee3\u9996\u9009\u65b9\u6848<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>3. \u914d\u7f6e\u6ce8\u610f\u4e8b\u9879<\/h4>\n<ul>\n<li>\u6027\u80fd\u5f71\u54cd&#xff1a;\u5b89\u5168\u5934\u901a\u8fc7\u670d\u52a1\u5668\u54cd\u5e94\u6dfb\u52a0&#xff0c;\u65e0\u524d\u7aef\u6027\u80fd\u5f00\u9500<\/li>\n<li>CORS\u914d\u5408&#xff1a;\u82e5\u5141\u8bb8\u7279\u5b9a\u57df\u540d\u5d4c\u5165&#xff0c;\u9700\u540c\u65f6\u914d\u7f6eCORS\u5934<\/li>\n<li>\u7f13\u5b58\u63a7\u5236&#xff1a;\u5efa\u8bae\u901a\u8fc7CDN\u5168\u5c40\u90e8\u7f72\u5b89\u5168\u5934&#xff0c;\u786e\u4fdd\u6240\u6709\u8282\u70b9\u751f\u6548<\/li>\n<\/ul>\n<h3>\u4e94\u3001\u8fdb\u9636\u4f18\u5316\u65b9\u6848<\/h3>\n<h4>1. \u52a8\u6001\u767d\u540d\u5355\u673a\u5236<\/h4>\n<p><span class=\"token keyword\">const<\/span> <span class=\"token constant\">ALLOWED_DOMAINS<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token string\">&#039;trusted.com&#039;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#039;partner.com&#039;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">const<\/span> parentDomain <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">URL<\/span><span class=\"token punctuation\">(<\/span>window<span class=\"token punctuation\">.<\/span>top<span class=\"token punctuation\">.<\/span>location<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span>hostname<span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>window<span class=\"token punctuation\">.<\/span>top <span class=\"token operator\">!&#061;&#061;<\/span> window<span class=\"token punctuation\">.<\/span>self <span class=\"token operator\">&amp;&amp;<\/span> <span class=\"token operator\">!<\/span><span class=\"token constant\">ALLOWED_DOMAINS<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">includes<\/span><span class=\"token punctuation\">(<\/span>parentDomain<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token function\">showIframeWarning<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h4>2. \u54cd\u5e94\u5f0f\u6837\u5f0f\u4f18\u5316<\/h4>\n<p><span class=\"token comment\">\/* \u5c0f\u5c4f\u5e55\u8bbe\u5907\u4f18\u5316 *\/<\/span><br \/>\n<span class=\"token atrule\"><span class=\"token rule\">&#064;media<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token property\">max-width<\/span><span class=\"token punctuation\">:<\/span> 768px<span class=\"token punctuation\">)<\/span><\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token selector\">.iframe-warning<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token property\">position<\/span><span class=\"token punctuation\">:<\/span> absolute<span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token property\">top<\/span><span class=\"token punctuation\">:<\/span> auto<span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token property\">bottom<\/span><span class=\"token punctuation\">:<\/span> 0<span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token property\">border-radius<\/span><span class=\"token punctuation\">:<\/span> 8px 8px 0 0<span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h4>3. \u7ed3\u5408Post-Message\u901a\u4fe1<\/h4>\n<p><span class=\"token comment\">\/\/ \u7236\u7a97\u53e3\u4e0e\u5b50\u7a97\u53e3\u53cc\u5411\u901a\u4fe1\u68c0\u6d4b<\/span><br \/>\n<span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>window<span class=\"token punctuation\">.<\/span>top <span class=\"token operator\">!&#061;&#061;<\/span> window<span class=\"token punctuation\">.<\/span>self<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    window<span class=\"token punctuation\">.<\/span>top<span class=\"token punctuation\">.<\/span><span class=\"token function\">postMessage<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">{<\/span> <span class=\"token literal-property property\">type<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#039;iframeDetection&#039;<\/span> <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#039;*&#039;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    window<span class=\"token punctuation\">.<\/span><span class=\"token function\">addEventListener<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;message&#039;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token parameter\">event<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#061;&gt;<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>event<span class=\"token punctuation\">.<\/span>data<span class=\"token punctuation\">.<\/span>type <span class=\"token operator\">&#061;&#061;&#061;<\/span> <span class=\"token string\">&#039;allowIframe&#039;<\/span> <span class=\"token operator\">&amp;&amp;<\/span> event<span class=\"token punctuation\">.<\/span>origin <span class=\"token operator\">&#061;&#061;&#061;<\/span> <span class=\"token string\">&#039;https:\/\/trusted.com&#039;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n            <span class=\"token comment\">\/\/ \u5141\u8bb8\u53ef\u4fe1\u7236\u7a97\u53e3\u5d4c\u5165<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span> <span class=\"token keyword\">else<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n            <span class=\"token function\">showIframeWarning<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h3>\u516d\u3001\u6700\u4f73\u5b9e\u8df5\u5efa\u8bae<\/h3>\n<li>\n<p>\u5206\u5c42\u9632\u62a4\u7b56\u7565&#xff1a;<\/p>\n<ul>\n<li>\u7b2c\u4e00\u5c42&#xff1a;\u670d\u52a1\u5668\u7aef\u914d\u7f6eCSP\u5934&#xff08;\u4f18\u5148\u963b\u6b62\u5d4c\u5165&#xff09;<\/li>\n<li>\u7b2c\u4e8c\u5c42&#xff1a;\u524d\u7aef\u68c0\u6d4b\u5e76\u63d0\u793a\u7528\u6237&#xff08;\u589e\u5f3a\u7528\u6237\u5f15\u5bfc&#xff09;<\/li>\n<li>\u7b2c\u4e09\u5c42&#xff1a;\u4e1a\u52a1\u903b\u8f91\u989d\u5916\u6821\u9a8c&#xff08;\u5982\u652f\u4ed8\u573a\u666f\u7981\u6b62\u5728iframe\u4e2d\u6267\u884c&#xff09;<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u5408\u89c4\u6027\u8003\u8651&#xff1a;<\/p>\n<ul>\n<li>\u6b27\u76dfGDPR\u573a\u666f&#xff1a;\u9700\u5728\u63d0\u793a\u4fe1\u606f\u4e2d\u8bf4\u660eiframe\u5d4c\u5165\u5bf9Cookie\u4f7f\u7528\u7684\u5f71\u54cd<\/li>\n<li>\u91d1\u878d\u884c\u4e1a&#xff1a;\u5efa\u8bae\u540c\u65f6\u542f\u7528SSL\u8bc1\u4e66\u7ed1\u5b9a\u548ciframe\u68c0\u6d4b<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u76d1\u63a7\u4e0e\u65e5\u5fd7&#xff1a;<\/p>\n<ul>\n<li>\u8bb0\u5f55\u6bcf\u6b21\u89e6\u53d1iframe\u63d0\u793a\u7684\u6765\u6e90\u57df\u540d&#xff08;window.top.location.host&#xff09;<\/li>\n<li>\u901a\u8fc7Google Analytics\u81ea\u5b9a\u4e49\u4e8b\u4ef6\u8ffd\u8e2a\u63d0\u793a\u7ec4\u4ef6\u7684\u89e6\u53d1\u6b21\u6570\u548c\u7528\u6237\u8df3\u8f6c\u7387<\/li>\n<\/ul>\n<\/li>\n<h3>\u7ed3\u8bed<\/h3>\n<p>\u68c0\u6d4b\u548c\u9632\u8303\u7f51\u9875\u88ab\u975e\u6cd5\u5d4c\u5165\u662f\u4e00\u4e2a\u9700\u8981\u524d\u7aef\u4e0e\u670d\u52a1\u5668\u7aef\u534f\u540c\u7684\u7cfb\u7edf\u6027\u5de5\u7a0b\u3002\u5355\u7eaf\u7684\u524d\u7aef\u68c0\u6d4b\u65e0\u6cd5\u5b8c\u5168\u963b\u6b62\u5d4c\u5165\u884c\u4e3a&#xff0c;\u4f46\u7ed3\u5408Content-Security-Policy\u7b49\u670d\u52a1\u5668\u5b89\u5168\u5934&#xff0c;\u80fd\u591f\u6784\u5efa\u8d77\u66f4\u53ef\u9760\u7684\u9632\u62a4\u4f53\u7cfb\u3002\u5efa\u8bae\u6839\u636e\u4e1a\u52a1\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u65b9\u6848&#xff1a;\u5bf9\u4e8e\u5b89\u5168\u6027\u8981\u6c42\u6781\u9ad8\u7684\u573a\u666f&#xff08;\u5982\u5728\u7ebf\u652f\u4ed8&#xff09;&#xff0c;\u5e94\u4f18\u5148\u91c7\u7528frame-ancestors &#039;none&#039;\u5b8c\u5168\u7981\u6b62\u5d4c\u5165&#xff1b;\u5bf9\u4e8e\u9700\u8981\u652f\u6301\u53ef\u4fe1\u5408\u4f5c\u65b9\u5d4c\u5165\u7684\u573a\u666f&#xff0c;\u5219\u53ef\u901a\u8fc7\u767d\u540d\u5355\u673a\u5236\u5b9e\u73b0\u7075\u6d3b\u7ba1\u63a7\u3002\u901a\u8fc7\u5206\u5c42\u9632\u62a4\u548c\u6301\u7eed\u4f18\u5316&#xff0c;\u65e2\u80fd\u4fdd\u969c\u7528\u6237\u4f53\u9a8c&#xff0c;\u53c8\u80fd\u6709\u6548\u964d\u4f4e\u5b89\u5168\u98ce\u9669\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1k\u6b21\uff0c\u70b9\u8d5e38\u6b21\uff0c\u6536\u85cf9\u6b21\u3002\u672c\u6587\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u5982\u4f55\u68c0\u6d4b\u548c\u9632\u6b62\u7f51\u9875\u88ab\u5916\u90e8iframe\u5d4c\u5165\u7684\u5b8c\u6574\u89e3\u51b3\u65b9\u6848\u3002\u9996\u5148\u5206\u6790\u4e86iframe\u5d4c\u5165\u5e26\u6765\u7684\u98ce\u9669\uff08\u7528\u6237\u4f53\u9a8c\u53d7\u635f\u3001\u6d41\u91cf\u52ab\u6301\u3001\u70b9\u51fb\u52ab\u6301\u653b\u51fb\u7b49\uff09\uff0c\u7136\u540e\u63d0\u4f9b\u4e86\u524d\u7aef\u68c0\u6d4b\u7684\u6838\u5fc3\u4ee3\u7801\u5b9e\u73b0\uff08window.top\u4e0ewindow.self\u6bd4\u5bf9\uff09\u53ca\u6837\u5f0f\u4f18\u5316\u7684\u8b66\u544a\u7ec4\u4ef6\u3002\u6587\u7ae0\u5bf9\u6bd4\u4e86\u524d\u7aef\u65b9\u6848\u7684\u4f18\u7f3a\u70b9\uff0c\u5e76\u91cd\u70b9\u63a8\u8350\u670d\u52a1\u5668\u7aef\u9632\u62a4\u65b9\u6848\uff0c\u5305\u62ecX-Frame-Options\u548c\u66f4\u73b0\u4ee3\u7684Content-Security-Policy\u5934\u90e8\u914d\u7f6e\u3002\u6700\u540e\u63d0\u51fa\u5206\u5c42\u9632\u62a4\u3001\u52a8\u6001\u767d\u540d\u5355\u3001Post-Message\u901a\u4fe1\u7b49\u8fdb\u9636\u4f18\u5316\u7b56\u7565\uff0c\u5efa\u8bae\u6839\u636e\u4e1a\u52a1\u9700\u6c42\u7ed3\u5408\u524d\u7aef\u68c0<\/p>\n","protected":false},"author":2,"featured_media":41311,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[87,3799,2624],"topic":[],"class_list":["post-41312","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-87","tag-3799","tag-2624"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5982\u4f55\u68c0\u6d4b\u7f51\u9875\u662f\u5426\u88ab\u5916\u90e8iframe\u5d4c\u5165\uff1f\u4ece\u524d\u7aef\u68c0\u6d4b\u5230\u670d\u52a1\u5668\u9632\u62a4\u7684\u5b8c\u6574\u65b9\u6848 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/41312.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5982\u4f55\u68c0\u6d4b\u7f51\u9875\u662f\u5426\u88ab\u5916\u90e8iframe\u5d4c\u5165\uff1f\u4ece\u524d\u7aef\u68c0\u6d4b\u5230\u670d\u52a1\u5668\u9632\u62a4\u7684\u5b8c\u6574\u65b9\u6848 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1k\u6b21\uff0c\u70b9\u8d5e38\u6b21\uff0c\u6536\u85cf9\u6b21\u3002\u672c\u6587\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u5982\u4f55\u68c0\u6d4b\u548c\u9632\u6b62\u7f51\u9875\u88ab\u5916\u90e8iframe\u5d4c\u5165\u7684\u5b8c\u6574\u89e3\u51b3\u65b9\u6848\u3002\u9996\u5148\u5206\u6790\u4e86iframe\u5d4c\u5165\u5e26\u6765\u7684\u98ce\u9669\uff08\u7528\u6237\u4f53\u9a8c\u53d7\u635f\u3001\u6d41\u91cf\u52ab\u6301\u3001\u70b9\u51fb\u52ab\u6301\u653b\u51fb\u7b49\uff09\uff0c\u7136\u540e\u63d0\u4f9b\u4e86\u524d\u7aef\u68c0\u6d4b\u7684\u6838\u5fc3\u4ee3\u7801\u5b9e\u73b0\uff08window.top\u4e0ewindow.self\u6bd4\u5bf9\uff09\u53ca\u6837\u5f0f\u4f18\u5316\u7684\u8b66\u544a\u7ec4\u4ef6\u3002\u6587\u7ae0\u5bf9\u6bd4\u4e86\u524d\u7aef\u65b9\u6848\u7684\u4f18\u7f3a\u70b9\uff0c\u5e76\u91cd\u70b9\u63a8\u8350\u670d\u52a1\u5668\u7aef\u9632\u62a4\u65b9\u6848\uff0c\u5305\u62ecX-Frame-Options\u548c\u66f4\u73b0\u4ee3\u7684Content-Security-Policy\u5934\u90e8\u914d\u7f6e\u3002\u6700\u540e\u63d0\u51fa\u5206\u5c42\u9632\u62a4\u3001\u52a8\u6001\u767d\u540d\u5355\u3001Post-Message\u901a\u4fe1\u7b49\u8fdb\u9636\u4f18\u5316\u7b56\u7565\uff0c\u5efa\u8bae\u6839\u636e\u4e1a\u52a1\u9700\u6c42\u7ed3\u5408\u524d\u7aef\u68c0\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/41312.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-06-01T00:11:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250601001059-683b9a939f8bd.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/41312.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/41312.html\",\"name\":\"\u5982\u4f55\u68c0\u6d4b\u7f51\u9875\u662f\u5426\u88ab\u5916\u90e8iframe\u5d4c\u5165\uff1f\u4ece\u524d\u7aef\u68c0\u6d4b\u5230\u670d\u52a1\u5668\u9632\u62a4\u7684\u5b8c\u6574\u65b9\u6848 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-06-01T00:11:02+00:00\",\"dateModified\":\"2025-06-01T00:11:02+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/41312.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/41312.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/41312.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5982\u4f55\u68c0\u6d4b\u7f51\u9875\u662f\u5426\u88ab\u5916\u90e8iframe\u5d4c\u5165\uff1f\u4ece\u524d\u7aef\u68c0\u6d4b\u5230\u670d\u52a1\u5668\u9632\u62a4\u7684\u5b8c\u6574\u65b9\u6848\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u5982\u4f55\u68c0\u6d4b\u7f51\u9875\u662f\u5426\u88ab\u5916\u90e8iframe\u5d4c\u5165\uff1f\u4ece\u524d\u7aef\u68c0\u6d4b\u5230\u670d\u52a1\u5668\u9632\u62a4\u7684\u5b8c\u6574\u65b9\u6848 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/41312.html","og_locale":"zh_CN","og_type":"article","og_title":"\u5982\u4f55\u68c0\u6d4b\u7f51\u9875\u662f\u5426\u88ab\u5916\u90e8iframe\u5d4c\u5165\uff1f\u4ece\u524d\u7aef\u68c0\u6d4b\u5230\u670d\u52a1\u5668\u9632\u62a4\u7684\u5b8c\u6574\u65b9\u6848 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1k\u6b21\uff0c\u70b9\u8d5e38\u6b21\uff0c\u6536\u85cf9\u6b21\u3002\u672c\u6587\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u5982\u4f55\u68c0\u6d4b\u548c\u9632\u6b62\u7f51\u9875\u88ab\u5916\u90e8iframe\u5d4c\u5165\u7684\u5b8c\u6574\u89e3\u51b3\u65b9\u6848\u3002\u9996\u5148\u5206\u6790\u4e86iframe\u5d4c\u5165\u5e26\u6765\u7684\u98ce\u9669\uff08\u7528\u6237\u4f53\u9a8c\u53d7\u635f\u3001\u6d41\u91cf\u52ab\u6301\u3001\u70b9\u51fb\u52ab\u6301\u653b\u51fb\u7b49\uff09\uff0c\u7136\u540e\u63d0\u4f9b\u4e86\u524d\u7aef\u68c0\u6d4b\u7684\u6838\u5fc3\u4ee3\u7801\u5b9e\u73b0\uff08window.top\u4e0ewindow.self\u6bd4\u5bf9\uff09\u53ca\u6837\u5f0f\u4f18\u5316\u7684\u8b66\u544a\u7ec4\u4ef6\u3002\u6587\u7ae0\u5bf9\u6bd4\u4e86\u524d\u7aef\u65b9\u6848\u7684\u4f18\u7f3a\u70b9\uff0c\u5e76\u91cd\u70b9\u63a8\u8350\u670d\u52a1\u5668\u7aef\u9632\u62a4\u65b9\u6848\uff0c\u5305\u62ecX-Frame-Options\u548c\u66f4\u73b0\u4ee3\u7684Content-Security-Policy\u5934\u90e8\u914d\u7f6e\u3002\u6700\u540e\u63d0\u51fa\u5206\u5c42\u9632\u62a4\u3001\u52a8\u6001\u767d\u540d\u5355\u3001Post-Message\u901a\u4fe1\u7b49\u8fdb\u9636\u4f18\u5316\u7b56\u7565\uff0c\u5efa\u8bae\u6839\u636e\u4e1a\u52a1\u9700\u6c42\u7ed3\u5408\u524d\u7aef\u68c0","og_url":"https:\/\/www.wsisp.com\/helps\/41312.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-06-01T00:11:02+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250601001059-683b9a939f8bd.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/41312.html","url":"https:\/\/www.wsisp.com\/helps\/41312.html","name":"\u5982\u4f55\u68c0\u6d4b\u7f51\u9875\u662f\u5426\u88ab\u5916\u90e8iframe\u5d4c\u5165\uff1f\u4ece\u524d\u7aef\u68c0\u6d4b\u5230\u670d\u52a1\u5668\u9632\u62a4\u7684\u5b8c\u6574\u65b9\u6848 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-06-01T00:11:02+00:00","dateModified":"2025-06-01T00:11:02+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/41312.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/41312.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/41312.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u5982\u4f55\u68c0\u6d4b\u7f51\u9875\u662f\u5426\u88ab\u5916\u90e8iframe\u5d4c\u5165\uff1f\u4ece\u524d\u7aef\u68c0\u6d4b\u5230\u670d\u52a1\u5668\u9632\u62a4\u7684\u5b8c\u6574\u65b9\u6848"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/41312","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=41312"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/41312\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/41311"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=41312"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=41312"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=41312"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=41312"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}