diff --git a/pywb/static/wb_frame.js b/pywb/static/wb_frame.js index d743e658..6f90e3ed 100644 --- a/pywb/static/wb_frame.js +++ b/pywb/static/wb_frame.js @@ -109,6 +109,23 @@ function ContentFrame(content_info) { this.handle_message = function(state) { var type = state.wb_type; + + if (type === 'load') { + window.document.title = state.title + ' ' + state.ts; + var head = document.querySelector('head'); + var oldLink = document.querySelectorAll("link[rel*='icon']"); + for (var i = 0; i < oldLink.length; i++) { + head.removeChild(oldLink[i]); + } + var len = state.icons.length; + for (var i = 0; i < len; i++) { + var icon = state.icons[i]; + var link = document.createElement('link'); + link.rel = icon.rel; + link.href = icon.href; + head.appendChild(link); + } + } if (type == "load" || type == "replace-url") { this.set_url(state); diff --git a/pywb/static/wombat.js b/pywb/static/wombat.js index 89780bd5..ab2d2dc4 100644 --- a/pywb/static/wombat.js +++ b/pywb/static/wombat.js @@ -3619,15 +3619,26 @@ var _WBWombat = function($wbwindow, wbinfo) { return; } - var message = { - "url": $wbwindow.WB_wombat_location.href, - "ts": wbinfo.timestamp, - "request_ts": wbinfo.request_ts, - "is_live": wbinfo.is_live, - "title": $wbwindow.document ? $wbwindow.document.title : "", - "readyState": $wbwindow.document.readyState, - "wb_type": "load" - } + var icons = []; + var hicons = $wbwindow.document.querySelectorAll("link[rel*='icon']"); + for (var i = 0; i < hicons.length; i++) { + var hicon = hicons[i]; + icons.push({ + rel: hicon.rel, + href: wb_getAttribute.call(hicon, 'href') + }) + } + + var message = { + "icons": icons, + "url": $wbwindow.WB_wombat_location.href, + "ts": wbinfo.timestamp, + "request_ts": wbinfo.request_ts, + "is_live": wbinfo.is_live, + "title": $wbwindow.document ? $wbwindow.document.title : "", + "readyState": $wbwindow.document.readyState, + "wb_type": "load" + } send_top_message(message); }