Interactive interface for browsing global, full-resolution satellite imagery
update to wrap embed code in iframe, update docs
Ed Plato4d0a82f1c852
diff --git a/doc/embed.md b/doc/embed.mdindex 58257e4e0..dc34e6d8b 100644--- a/doc/embed.md+++ b/doc/embed.md@@ -1,9 +1,11 @@# Embed mode-To embed NASA Worldview in your page, navigate to the share toolbar, select the `embed` tab and copy the embed link.+To embed NASA Worldview in your page, navigate to the share toolbar, select the `embed` tab, and copy the code that wraps the current Worldview instance in an `<iframe>` inline element. Add this HTML code to your website to embed Worldview. You will need to wrap the `<iframe>` code in a wrapper with your desired `width`, `height`, and any additional style changes.-**Note:** Certain application features and interactions are not available in embed mode. Please try to think of a way to share your concept using the available features. We recommend to not share more layers than necessary and to provide detailed captions to help the user better understand the science concepts you are presenting.+See [https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe) for more information on the `<iframe>` inline element and an explanation of the its attributes.++**Example `<iframe>` code:**-TODO:-IFRAME-WIDTH/HEIGHT+```<iframe src="https://worldview.earthdata.nasa.gov/?em=true" role="application" sandbox="allow-scripts allow-same-origin allow-forms allow-popups" width="100%" height="100%" allow="fullscreen; autoplay;" loading="lazy"></iframe>```++**Note:** Certain application features and interactions are not available in embed mode. Please try to think of a way to share your concept using the available features. We recommend to not share more layers than necessary and to provide detailed captions to help the user better understand the science concepts you are presenting.diff --git a/web/js/containers/share.js b/web/js/containers/share.jsindex fb3c6156a..69adb7c6a 100644--- a/web/js/containers/share.js+++ b/web/js/containers/share.js@@ -16,7 +16,7 @@ import {} from 'reactstrap';import ShareLinks from '../components/toolbar/share/links';import ShareToolTips from '../components/toolbar/share/tooltips';-import { getPermalink, getShareLink } from '../modules/link/util';+import { getPermalink, getShareLink, wrapWithIframe } from '../modules/link/util';import getSelectedDate from '../modules/date/selectors';import Checkbox from '../components/util/checkbox';import { requestShortLink } from '../modules/link/actions';@@ -240,6 +240,7 @@ class ShareLinkContainer extends Component {activeTab,} = this.state;const embedValue = this.getPermalink(true);+ const embedIframeHTMLCode = wrapWithIframe(embedValue);return (<TabPane tabId="embed" className="share-tab-embed">@@ -252,7 +253,7 @@ class ShareLinkContainer extends Component {{' '}for a guide.</p>- {this.renderInputGroup(embedValue, 'embed')}+ {this.renderInputGroup(embedIframeHTMLCode, 'embed')}</>)}</TabPane>diff --git a/web/js/modules/link/util.js b/web/js/modules/link/util.jsindex 080d17ef9..bf2c47bd1 100644--- a/web/js/modules/link/util.js+++ b/web/js/modules/link/util.js@@ -107,3 +107,5 @@ export function getPermalink(queryString, selectedDate, isEmbed) {return permalink;}++export function wrapWithIframe(value) { return `<iframe src="${value}" role="application" sandbox="allow-scripts allow-same-origin allow-forms allow-popups" width="100%" height="100%" allow="fullscreen; autoplay;" loading="lazy"></iframe>`; }