Nuxt:无法在“文档”上执行“写入”

时间:2019-04-17 17:26:15

标签: javascript php vue.js ssr nuxt

我有一个PHP电子商务应用程序,正在将Nuxt应用程序(新的结帐页面)嵌入其中。在PHP方面,页脚中有一个外部脚本,该脚本运行并使用document.write()将“诺顿防病毒”图章附加到DOM上。很好。

我的问题是在新的Nuxt应用结帐页面内。我所做的就是复制此页面的页脚,使其看上去与PHP的页脚相同。由于document.write(),该外部脚本无法运行,我最终遇到此错误。

Failed to execute 'write' on 'Document': It isn't possible to write 
into a document from an asynchronously-loaded external script unless 
it is explicitly opened.

我认为我对运行情况和运行时间有误解,但是PHP和Nuxt都是服务器端渲染的,那么为什么它可以在PHP而不是Nuxt上运行?

要为Norton安全性图标添加的代码

<table width="135" border="0" cellpadding="2" cellspacing="0" title="Click to Verify - This site chose Symantec SSL for secure e-commerce and confidential communications." style="display: inline-block; vertical-align: middle;">
   <tr>
      <td width="135" align="center" valign="top">
         <script type="text/javascript" src="https://seal.websecurity.norton.com/getseal?host_name=www.mywebsite.com&amp;size=M&amp;use_flash=NO&amp;use_transparent=YES&amp;lang=en"></script><br />
         <a href="http://www.symantec.com/ssl-certificates" target="_blank"  style="color:#000000; text-decoration:none; font:bold 7px verdana,sans-serif; letter-spacing:.5px; text-align:center; margin:0px; padding:0px;">ABOUT SSL CERTIFICATES</a>
      </td>
   </tr>
</table>
</div>

导致错误的我的组件

<template>
    <div>
      <table width="135" border="0" cellpadding="2" cellspacing="0" title="Click to Verify - This site chose Symantec SSL for secure e-commerce and confidential communications." style="display: inline-block; vertical-align: middle;">
        <tr>
          <td width="135" align="center" valign="top"><script type="text/javascript" src="https://seal.websecurity.norton.com/getseal?host_name=www.mywebsite.com&amp;size=M&amp;use_flash=NO&amp;use_transparent=YES&amp;lang=en"></script><br />
            <a href="http://www.symantec.com/ssl-certificates" target="_blank"  style="color:#000000; text-decoration:none; font:bold 7px verdana,sans-serif; letter-spacing:.5px; text-align:center; margin:0px; padding:0px;">ABOUT SSL CERTIFICATES</a></td>
        </tr>
      </table>
    </div>
</template>

0 个答案:

没有答案