3

On Chrome, does anybody know how to allow the Google Developer Console to access the javascript file that is linked to an HTML page requested from a dialog page? In my website, all javascript files are easily accessed from a window that contains the HTML page, but when I open a dialog box that through JQuery will request an HTML page, the linked javascript file won't come up in the Console.

Here's how I launch a dialog box with HTML (link) embedded:

function load_dialog(link, title, width, height){

//Take care of the options first.
var options = {

    autoOpen: true,
    position: "top",
    closeOnEscape: true,
    title: title,
    width: width,
    height: height,
    modal: true,
    resizable: false,
    show: {effect:"fade", duration:500},
    close: function (event, ui){
        dialog_box.dialog("destroy").remove();
    }
};

//Launch the dialog.
var dialog_box = $("<div></div>").load(link).dialog(options);
return false;

}

I should also add that it is possible to see the javascript linked to this HTML when I open the dialog box through a new window.

Thanks in advance!

4

2 に答える 2

1

私はまったく同じ質問をしたので、この質問に興味がありました。andyb が言ったように、 [ネットワーク] タブに表示されますが、動的に追加されたファイルをデバッグする機会がないため、[ソース] タブに表示されないことを意味します。

グーグルで調べた後、同様の質問をしているstackoverflowスレッドに出くわしました。

彼らが思いついたのは次のとおりです。

ブレークポイントを設定したい場合は、設定しdebugger;たい行を追加するだけです。ファイル全体を [ソース] タブに表示する必要がある場合は、追加できます。

//@ sourceURL=myfile.js
//or 
//@ sourceURL=path/to/js/myfile.js

ロードしたファイルの最後に。

また、何をしなければならないかを説明しているChrome 開発者ツールのドキュメントエントリも見つけました。残念ながら、デモは壊れています (コンソールにエラーが表示されます)

于 2013-05-09T16:59:02.917 に答える