简体   繁体   English

停止执行内联JavaScript

[英]stop inline javascript from executing

I use simple php parser to load a page, but within the blog post there is a injected fb javascript, the DOM look like this 我使用简单的php解析器加载页面,但是在博客文章中有注入的fb javascript,DOM看起来像这样

I tried using jQuery to remove like $('#fb-root') but when I think back of course it doesn't work, because jQuery run later than the like button plugin. 我尝试使用jQuery删除$('#fb-root')但是当我回想起来当然不起作用,因为jQuery的运行时间比like button插件晚。

I do want to return header plain/text because I want to keep the style of some part. 我确实想返回标头纯文本,因为我想保留某些部分的样式。

Well, of course you could just use some CSS: 好吧,当然您可以只使用一些CSS:

#fb-root { display : none; }

Other than that, you could use an interval to check if "fb-root" has already been written do the document and then remove it... But I wouldn't suggest that since CSS does the job way easier. 除此之外,您可以使用一个间隔来检查是否已经编写了“ fb-root”来处理文档,然后将其删除...但是我不建议这样做,因为CSS可以使工作更容易。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM