* @param {!Window} win * @param {string} src * @param {string=} attributionSrc * @param {(Element|./service/ampdoc-impl.AmpDoc)=} opt_elementOrAmpDoc Whether services are provided by an * element. * @return {!Element}
(win, src, attributionSrc, opt_elementOrAmpDoc)
| 48 | * @return {!Element} |
| 49 | */ |
| 50 | function createNoReferrerPixel(win, src, attributionSrc, opt_elementOrAmpDoc) { |
| 51 | if (isReferrerPolicySupported()) { |
| 52 | return createImagePixel( |
| 53 | win, |
| 54 | src, |
| 55 | true, |
| 56 | attributionSrc, |
| 57 | opt_elementOrAmpDoc |
| 58 | ); |
| 59 | } else { |
| 60 | // if "referrerPolicy" is not supported, use iframe wrapper |
| 61 | // to scrub the referrer. |
| 62 | const iframe = createElementWithAttributes( |
| 63 | /** @type {!Document} */ (win.document), |
| 64 | 'iframe', |
| 65 | { |
| 66 | 'src': 'about:blank', |
| 67 | 'style': 'display:none', |
| 68 | } |
| 69 | ); |
| 70 | iframe.onload = () => { |
| 71 | createImagePixel( |
| 72 | iframe.contentWindow, |
| 73 | src, |
| 74 | undefined, |
| 75 | undefined, |
| 76 | opt_elementOrAmpDoc |
| 77 | ); |
| 78 | }; |
| 79 | win.document.body.appendChild(iframe); |
| 80 | return iframe; |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * @param {!Window} win |
no test coverage detected