如何为 angularjs 站点设置 Norton Seal?
How to setup norton seal for angularjs site?
我正在尝试为我的 angularjs 站点设置 norton Seal。每次当诺顿脚本加载时,它都会在我的控制台中显示一个警告,如
"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."
我了解到脚本正在异步加载,这意味着它脱离了文档解析状态。 JS 引擎根本无法知道 document.write 应该在页面中的何处执行。
我正在使用 postcribe
now.But 我想知道是否有比使用 postscribe
更好的方法
有什么方法可以制作这个run.Thanks求助。
我今天遇到了同样的问题,在网上搜索并与一些同事讨论后,我们得出了以下解决方案:
首先你需要使用postcribe: https://github.com/krux/postscribe
它将替换所有 document.write
调用,这样您就不会再从浏览器中收到此错误。
例如就我而言,我执行以下操作:
.postscribe('#seal', '... put the norton seal script tag here ..');
那么你只需要在你的网站上的某个地方有一个div id="seal"
,它就会被实际的印章图像所取代。
但是,如果此 div
在您的 angular 应用程序中,您需要在 angular 应用程序中调用 postscribe
。
我通过创建一个指令(其中包含 div)来做到这一点,我在其中添加了一个 post
link 函数。在 post 函数中,我只是像上面那样调用 postscribe。
如果您需要这种方法,我可以写一个片段。
我正在尝试为我的 angularjs 站点设置 norton Seal。每次当诺顿脚本加载时,它都会在我的控制台中显示一个警告,如
"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."
我了解到脚本正在异步加载,这意味着它脱离了文档解析状态。 JS 引擎根本无法知道 document.write 应该在页面中的何处执行。
我正在使用 postcribe
now.But 我想知道是否有比使用 postscribe
有什么方法可以制作这个run.Thanks求助。
我今天遇到了同样的问题,在网上搜索并与一些同事讨论后,我们得出了以下解决方案:
首先你需要使用postcribe: https://github.com/krux/postscribe
它将替换所有 document.write
调用,这样您就不会再从浏览器中收到此错误。
例如就我而言,我执行以下操作:
.postscribe('#seal', '... put the norton seal script tag here ..');
那么你只需要在你的网站上的某个地方有一个div id="seal"
,它就会被实际的印章图像所取代。
但是,如果此 div
在您的 angular 应用程序中,您需要在 angular 应用程序中调用 postscribe
。
我通过创建一个指令(其中包含 div)来做到这一点,我在其中添加了一个 post
link 函数。在 post 函数中,我只是像上面那样调用 postscribe。
如果您需要这种方法,我可以写一个片段。