Skip to content

Commit

Permalink
nullになると、エラーになるので、空文字を返却するように修正
Browse files Browse the repository at this point in the history
  • Loading branch information
matsumoto-kouichi committed Feb 2, 2022
1 parent d5a1cb4 commit 0645db0
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions modules/gmosspBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,19 @@ function getUrlInfo(refererInfo) {
}

function getCanonicalUrl() {
try {
return window.top.document.head.querySelector('link[rel="canonical"]').href;
} catch (e) {
return window.document.head.querySelector('link[rel="canonical"]').href;
let link;
if (window.self !== window.top) {
try {
link = window.top.document.head.querySelector('link[rel="canonical"][href]');
} catch (e) { }
} else {
link = document.head.querySelector('link[rel="canonical"][href]');
}

if (link) {
return link.href;
}
return '';
}

function getMetaElements() {
Expand Down

0 comments on commit 0645db0

Please sign in to comment.