I've ran into an extremely strange issue recently. My script(which is shown below) loads everything from an HTML template file just fine, except it excludes head and body tags and spits the entire content directly into <html> </html> tags. Here is the code which is run in the content-script:
// load new <html> and replace current <html> with it
$.get(chrome.extension.getURL('index.html'), function(data) {
$('html').empty().append($.parseHTML(data));
});
I don't have the slightest clue about why is this happening. Any ideas about what might be causing this problem?
Updates:
I've tried to load head and body separately and.. it worked! Here is the updated code:
// load new <head> and replace current <head> with it
$.get(chrome.extension.getURL('head.html'), function(data) {
$('head').empty().append($.parseHTML(data));
});
// load new <body> and replace current <body> with it
$.get(chrome.extension.getURL('body.html'), function(data) {
$('body').empty().append($.parseHTML(data));
});
It would be better if it didn't work. Now I am even more confused. What difference does the new code make? Does JQuery have problems parsing head and body tags?
