我在网站上工作。它包含很多评论。当用户在任何浏览器中单击 view page source
时,我想隐藏或删除 HTML 中的评论。
这可能吗?如果可能的话,有人能说出实现它的方法吗。
最佳答案
目前我决定使用 php 创建 html 和 jquery 注释以将它们隐藏在查看源代码中
喜欢
<input type="submit" value="Submit">
<?php //this is comment regarding input ?>
可能它会影响性能......但没有找到其他方式
关于jquery的一记笔记。
//$('#upper_level_id0').css('color', 'red');<?php //works ?>
$('#upper_level_id'+index).remove();
在这个例子中 $('#upper_level_id'+index).remove();
不起作用。
$('#upper_level_id0').css('color', 'red');<?php //works ?>
//$('#upper_level_id0').css('color', 'red');
<?php //works ?>
$('#upper_level_id'+index).remove();
但在这个例子中一切正常。所以结论 <?php
评论更好的 tos 从新行开始
关于html - 如何隐藏或删除浏览器查看页面源代码中的评论?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21478064/