Skip to content

Commit

Permalink
Generated ads localhost should follow baseURI port if one exists (#36238
Browse files Browse the repository at this point in the history
)

* Ads localhost should follow baseURI port if one exists.

* Add parens around ports
  • Loading branch information
caroqliu committed Oct 6, 2021
1 parent 1ddd283 commit 07267c2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/3p-frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,13 @@ function getAdsLocalhost(win) {
if (adsUrl == 'https://3p.ampproject.net') {
adsUrl = 'http://ads.localhost'; // local dev with a localhost server
}
return adsUrl + ':' + (win.location.port || win.parent.location.port);
return (
adsUrl +
':' +
(new URL(win.document.baseURI)?.port ||
win.location.port ||
win.parent.location.port)
);
}

/**
Expand Down

0 comments on commit 07267c2

Please sign in to comment.