我正在寻找一种方法来记录我在Firefox中提交给谷歌的查询。有没有办法可以将它们存储在日志文件中?
干杯。
答案 0 :(得分:0)
您是否需要编写附加组件,您可以使用许多工具来解决此问题。 您可以选择:
https://developer.mozilla.org/en-US/Add-ons/Overlay_Extensions/XUL_School/Intercepting_Page_Loads
https://developer.mozilla.org/en/docs/Listening_to_events_on_all_tabs
要将JS msj(错误,警告,日志)记录到磁盘,请将环境变量XRE_CONSOLE_LOG设置为文件名的路径。即导出XRE_CONSOLE_LOG = / path / to / logfile或将XRE_CONSOLE_LOG = C:\ path \设置为\ logfile。
https://developer.mozilla.org/en-US/docs/Mozilla/Projects/XULRunner/Debugging_XULRunner_applications
或者你可以创建文件
https://developer.mozilla.org/en-US/Add-ons/Code_snippets/File_I_O
Components.utils.import("resource://gre/modules/NetUtil.jsm");
Components.utils.import("resource://gre/modules/FileUtils.jsm");
// get the "data.txt" file in the profile directory
var file = FileUtils.getFile("ProfD", ["GoogleQuery.txt"]);
// You can also optionally pass a flags parameter here. It defaults to
// FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE | FileUtils.MODE_TRUNCATE;
var ostream = FileUtils.openSafeFileOutputStream(file);
var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"].
createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
converter.charset = "UTF-8";
var istream = converter.convertToInputStream(data);
// The last argument (the callback) is optional.
NetUtil.asyncCopy(istream, ostream, function(status) {
if (!Components.isSuccessCode(status)) {
// Handle error!
return;
}
// Data has been written to the file.
//data is your string of your Google queries
});
答案 1 :(得分:0)
这是Firefox或IE用于记录查询的附加组件