2
我有聽的HTTP上修改請求並獲取頁面的位置發出請求Firefox擴展XPCOM組件:如何從firefox擴展xpcom組件中獲取啓動GET請求的頁面元素?
getLocationOfOriginatingWindow: function (httpChannel) {
try {
var notificationCallbacks;
if (httpChannel.notificationCallbacks) {
notificationCallbacks = httpChannel.notificationCallbacks;
}
else if (httpChannel.loadGroup && httpChannel.loadGroup.notificationCallbacks) {
notificationCallbacks = httpChannel.loadGroup.notificationCallbacks;
}
else {
return null;
}
return notificationCallbacks.getInterface(Components.interfaces.nsIDOMWindow).top.location;
}
catch (e) {
DEBUG("Exception getting Window Location: " + e + "\nChannel URI: " + httpChannel.URI.spec);
return null;
}
},
我也想獲得發出請求的頁面元素(img,腳本等)。有沒有辦法從httpChannel做到這一點?
我不確定內容策略結尾的含義。如果你的意思是通過查看頁面並搜索引發請求的元素,問題是某些對象(腳本,flash)可能非常不透明。也許你可以詳細說明一下? – 2011-01-28 06:29:10