Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[js] 第397天 在不支持js的浏览器中如何隐藏JavaScript代码? #2388

Open
haizhilin2013 opened this issue May 16, 2020 · 1 comment
Labels
js JavaScript

Comments

@haizhilin2013
Copy link
Collaborator

第397天 在不支持js的浏览器中如何隐藏JavaScript代码?

我也要出题

@haizhilin2013 haizhilin2013 added the js JavaScript label May 16, 2020
@zhaofeipeter
Copy link

zhaofeipeter commented Jul 25, 2020

在<script>标签之后的代码中添加“<!-– ”,不带引号。
在</script>标签之前添加“// –->”,代码中没有引号。
旧浏览器现在将JavaScript代码视为一个长的HTML注释。而支持JavaScript的浏览器则将“<! – ”和“// – >”作为一行注释。
如:
<script><!--
alert();
// --></script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
js JavaScript
Projects
None yet
Development

No branches or pull requests

2 participants