得到一个错误 "ns_error_unknown_protocol [英] getting an error "ns_error_unknown_protocol
问题描述
我在 firefox 中运行此代码时收到错误ns_error_unknown_protocol".我的代码有什么问题?我在 google chrome 中运行它,但它运行没有任何问题.它不显示任何错误消息?请帮助我.
im getting an error "ns_error_unknown_protocol" when i run this code in firefox.whats the problem with my code?i run this in google chrome,but it runs without any problem.it doesnt display any error messages?please help me out.
我的 javascript 是
my javascript is
<script>
$(document).ready(function()
{
var wrong="nnnn.htm";
var name = prompt("Please type in the password",'');
$.ajax({
type: 'POST',
dataType: 'json',
url: 'password.php',
data: {
name: name
},
success: function(data)
{
if (data.success == "good")
{
window.location.href =data.address;
}
else
{
alert(data);
location.href=wrong
}
},
error: function(data)
{
location.href=wrong;
},
});
});
</script>
我的php页面是
<?php
$password="123";
$prompt_password=$_POST['name'];
$success="good";
if($prompt_password==$password)
{
$output = array('success'=>'good',
'address'=>'itms-services://?action=download- manifest&url=http://feathersoft.net/projects/tests/Corelogic/Alert/AlertApp.plist');
echo json_encode($output,JSON_FORCE_OBJECT);
}
else
{
echo "error";
}
?>
推荐答案
Firefox 显示该错误,因为它现在不知道如何处理 itms-services://
协议.
Firefox is showing that error because it does not now how to handle itms-services://
protocol.
在 Firefox 中转到 about:config
并搜索 network.protocol-handler
如果您可以看到 network.protocol-handler.external.itms 的任何设置-services
那么只有 Firefox 可以处理您的请求.
Goto about:config
in Firefox and search for network.protocol-handler
if you can see any setting for network.protocol-handler.external.itms-services
then only Firefox can handle your request.
将 self.location.href = data.address
更改为 self.location = data.address
,因为 href
用于 HTTP.
Change self.location.href = data.address
to self.location = data.address
as href
is used for HTTP.
这篇关于得到一个错误 &quot;ns_error_unknown_protocol的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!