简体   繁体   English

我该怎么做才能验证我的代码错误

[英]What can I do to validate my code error

What can I do to make sure my code is secure? 我该怎么做才能确保我的代码安全? My add-on from Mozilla was validated, but apparently this line was unsecure: 我的Mozilla附加组件已通过验证,但显然这行是不安全的:

if (p.getElementById("bluebarholder"))
  p.getElementById("top").setAttribute('onclick', 'window.open("http://www.facebook.com","_self")');

I don't know whats the issue or how to solve it as they haven't replied to my message yet. 我不知道问题是什么或如何解决,因为他们尚未回复我的消息。

This is an example of "eval is evil". 这是“以恶为恶”的一个例子。
You're passing a string as an event handler, forcing the browser to fire up a Javascript parser to evaluate the string. 您正在将字符串作为事件处理程序传递,从而迫使浏览器启动Javascript解析器来评估该字符串。

Instead, you should call addEventListener to add a function as a handler. 相反,您应该调用addEventListener将函数添加为处理程序。

暂无
暂无

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

相关问题 扩展对象破坏了我的代码。 我能做什么? - Extending Object is breaking my code. What can I do? 在 VS 代码中,我可以验证我的 Javascript 但忽略特定的 Typescript 错误吗? - In VS Code Can I Validate my Javascript But Ignore a Specific Typescript Error? 我希望使我的代码验证一个字段,以确保它是四位数。 我怎样才能做到这一点? - I wish to make my code validate a field to make sure it is a number of four digits. How can I do this? 如何减少我的 useState 代码并使用 onChange 进行验证? - how can i reduce my useState code and validate with onChange? 运行此脚本时出现错误代码401,该怎么办? - I get the Error code 401 when I run this script, what can I do? 如何使网站上的Javascript代码与Firefox兼容 - What can I do to make the Javascript code on my site work with Firefox 如何运行此javascript代码以验证html文档中的表单? - How do I run this javascript code to validate my form in my html doc? 我不明白这段代码有什么错误 - I can't understand what is the error in this code 有人可以验证此JavaScript代码(待办事项列表) - Can someone validate this JavaScript code (to do list) 经过一段时间后,我可以使用什么代码制作视频/动画/声音剪辑? Javascript能做到这一点吗? - What code can I use to make a video/animation/soundclip to play after a certain time on my website? Can Javascript do this in particular?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM