MCPcopy Index your code
hub / github.com/ampproject/amphtml / navigateTo

Function navigateTo

ads/alp/handler.js:142–156  ·  view source on GitHub ↗

* Navigate to the given URL. Infers the target from the given anchor * tag. * @param {!Window} win * @param {!Element} a Anchor element * @param {string} url

(win, a, url)

Source from the content-addressed store, hash-verified

140 * @param {string} url
141 */
142function navigateTo(win, a, url) {
143 const target = (a.target || '_top').toLowerCase();
144 const a2aAncestor = getA2AAncestor(win);
145 if (a2aAncestor) {
146 a2aAncestor.win./*OK*/ postMessage(
147 'a2a;' +
148 JSON.stringify({
149 'url': url,
150 }),
151 a2aAncestor.origin
152 );
153 return;
154 }
155 openWindowDialog(win, url, target);
156}
157
158/**
159 * Establishes a connection to the AMP Cache and makes sure

Callers 1

handleClickFunction · 0.70

Calls 4

openWindowDialogFunction · 0.90
getA2AAncestorFunction · 0.85
stringifyMethod · 0.80
postMessageMethod · 0.45

Tested by

no test coverage detected