MCPcopy Create free account
hub / github.com/ampproject/amphtml / throwIfCannotNavigate

Method throwIfCannotNavigate

extensions/amp-iframe/0.1/amp-iframe.js:608–616  ·  view source on GitHub ↗

* Throws an error if window navigation is disallowed by this element. * Otherwise, does nothing. * @throws {!Error}

()

Source from the content-addressed store, hash-verified

606 * @throws {!Error}
607 */
608 throwIfCannotNavigate() {
609 if (!this.sandboxContainsToken_(this.sandbox_, 'allow-top-navigation')) {
610 throw user().createError(
611 '"AMP.navigateTo" is only allowed on ' +
612 '<amp-iframe> when its "sandbox" attribute contains ' +
613 '"allow-top-navigation".'
614 );
615 }
616 }
617
618 /**
619 * Updates the element's dimensions to accommodate the iframe's

Callers 2

handleNavigateTo_Method · 0.80
test-amp-iframe.jsFile · 0.80

Calls 3

sandboxContainsToken_Method · 0.95
userFunction · 0.90
createErrorMethod · 0.45

Tested by

no test coverage detected