jQuery.load()不适用于Chrome扩展程序

时间:2012-02-25 02:44:21

标签: jquery google-chrome-extension

我正在玩Chrome扩展程序,所以我做了 popup.html

<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
    var request;

    // Get the current tab information
    chrome.tabs.getSelected(null, function(tab) {
        request = tab.url;
    });


    $("#page").load(request, function(response, status, xhr) {
        if (status == "error") {
            $("#page").html("Sorry but there was an error: " + xhr.status + " " + xhr.statusText);
        }
    });
</script>

<span id="page"></span>

问题是,当我单击工具栏上的按钮时,它只显示一个小的空白方块弹出窗口。我试图检查弹出窗口,但调试控制台上没有错误。我该怎么做才能纠正这个问题?

1 个答案:

答案 0 :(得分:2)

您需要授予其访问* .jquery.com

的权限