Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在散列之前避免斜杠?_Javascript_Jquery_Html - Fatal编程技术网

Javascript 如何在散列之前避免斜杠?

Javascript 如何在散列之前避免斜杠?,javascript,jquery,html,Javascript,Jquery,Html,我正在使用,遇到了一个问题。 我创建了一个链接标记,带有如下hashbang: <a href="#!/hello/world">Click</a> 而不是这个(工作) 如何让浏览器使用工作URL 编辑1: 当我单击它调用的链接时: 但它必须呼吁: 你所说的是什么意思?浏览器称之为?单击链接时?您的.html()用法会打开XSS,因为它使用eval()浏览器称之为是什么意思?单击链接时?您的.html()用法会打开XSS,因为它使用eval() $.router.a

我正在使用,遇到了一个问题。 我创建了一个链接标记,带有如下hashbang:

<a href="#!/hello/world">Click</a>
而不是这个(工作)

如何让浏览器使用工作URL

编辑1

当我单击它调用的链接时:

但它必须呼吁:


你所说的
是什么意思?浏览器称之为
?单击链接时?您的
.html()
用法会打开XSS,因为它使用
eval()
浏览器称之为
是什么意思?单击链接时?您的
.html()
用法会打开XSS,因为它使用
eval()
$.router.add('/hello/:foo', function(data) {
    $("#mainContent").html("<b>Hello "+data.foo+"!</b>");
});
http://{url}/#!/hello/world
http://{url}#!/hello/world