当您使用 console.log 显示字符串时,Chrome 会将字符串的某些部分解释为链接,并相应地装饰控制台输出。怎么能防止呢?这是一个演示该问题的示例。请注意,尽管第二个 console.log 语句的输出中没有链接,但 Chrome 仍将其中的一部分解释为超链接。
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</head>
<body>
<p id="jedi_mind_trick">This is not the demo you are looking for. Move along!</p>
</body>
<script>
function example() {
var test = {data:$('#jedi_mind_trick').html(),obi_wan:"kenobi"};
}
console.log(typeof example, example);
console.log(typeof example.toString(), example.toString());
</script>
</html>