整个页面的源代码,包括chrome扩展中的框架

时间:2015-10-17 10:58:13

标签: javascript google-chrome-extension

该问题继续下面给出的链接。

Getting the source HTML of the current page from chrome extension

上述网址中给出的最佳答案获取了当前标签的源代码。但这并没有在源代码的iframe中获得源代码。

如何在整个页面中访问源代码,包括chrome扩展程序中的FRAMES?

1 个答案:

答案 0 :(得分:2)

使用chrome.tabs.executeScriptCREATE PROCEDURE sp_GetMonthVals(IN StartDate DATETIME, IN EndDate DATETIME) BEGIN DECLARE CurrentDate DATETIME; SET @CurrentDate = StartDate; label1: WHILE @CurrentDate < @EndDate DO SELECT @CurrentDate, DVal FROM Table1 WHERE MDate <= @CurrentDate ORDER BY MDate DESC LIMIT 1; SET @CurrentDate = DATE_ADD(CurrentDate, INTERVAL 1 DAY); END WHILE label1; END; CREATE TABLE Table1 (`id` int, `MDate` varchar(10), `DVal` int) ; INSERT INTO Table1 (`id`, `MDate`, `DVal`) VALUES (1, '2015-10-17', 25), (2, '2015-10-12', 20), (3, '2015-10-01', 5) ; CALL sp_GetMonthVals('2015-10-01', '2015-10-31'); 参数将代码注入所有帧。回调函数将接收一个包含所有帧结果的数组:

popup.js:

allFrames: true