Hide Javascript Code to Older Browser

大憨熊 提交于 2019-12-13 19:14:08

问题


Well I think this is kinda dumb but, I wonder if there's any way to hide Javascript code from older browsers without affecting the code for modern browsers.

Yes I know there's the <noscript></noscript> tag to show a message for older browsers, but sometimes very old browsers for any reason show the JS code as text if is not recognized.

I hope you understand.


回答1:


<script>
<!--
    Your code here
//-->
</script>


来源:https://stackoverflow.com/questions/11354453/hide-javascript-code-to-older-browser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!