收到错误“ns_error_unknown_protocol

时间:2013-03-14 12:25:59

标签: php javascript protocols

我在firefox.whats运行此代码时出现错误“ns_error_unknown_protocol”我的代码问题?我在谷歌浏览器中运行这个,但它运行没有任何问题。它没有显示任何错误消息?请帮帮我

我的javascript是

<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";
}

?>

2 个答案:

答案 0 :(得分:1)

Firefox正在显示该错误,因为它现在还没有处理itms-services://协议。

在Firefox中转到about:config并搜索network.protocol-handler,如果您看到network.protocol-handler.external.itms-services的任何设置,那么只有Firefox可以处理您的请求。

self.location.href = data.address更改为self.location = data.address,因为href用于HTTP。

答案 1 :(得分:0)

错误消息ns_error_unknown_protocol基本上是说浏览器不知道如何处理自定义协议itms-services://

我认为它与href设置有关。

尝试将其更改为

self.location = data.address;