Skip to content

Commit

Permalink
Be safe when using document title #979 (#980)
Browse files Browse the repository at this point in the history
  • Loading branch information
soulgalore committed Oct 30, 2019
1 parent b44aa46 commit 992e167
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion browserscripts/pageinfo/documentTitle.js
@@ -1,3 +1,11 @@
(function() {
return document.title;
// https://github.com/sitespeedio/browsertime/issues/979
if (typeof document.title === "string") {
return document.title;
} else {
const titles = document.getElementsByTagName("title");
if (titles.length > 0) {
return titles[0].innerHTML;
} else return "";
}
})();

0 comments on commit 992e167

Please sign in to comment.