Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

WV-2604: Reimplement embed mode with <object> tag (#4104)

Ryan Weiler792e65f54bde
diff --git a/web/js/containers/share.js b/web/js/containers/share.js
index e8c373337..ae89edfb9 100644
--- a/web/js/containers/share.js
+++ b/web/js/containers/share.js
@@ -16,7 +16,9 @@ import {
} from 'reactstrap';
import ShareLinks from '../components/toolbar/share/links';
import ShareToolTips from '../components/toolbar/share/tooltips';
-import { getPermalink, getShareLink, wrapWithIframe } from '../modules/link/util';
+import {
+ getPermalink, getShareLink, wrapWithObject,
+} from '../modules/link/util';
import { getSelectedDate } from '../modules/date/selectors';
import Checkbox from '../components/util/checkbox';
import HoverTooltip from '../components/util/hover-tooltip';
@@ -36,7 +38,7 @@ const getShortenRequestString = (mock, permalink) => {
);
};
-const SOCIAL_SHARE_TABS = ['link', 'social'];
+const SOCIAL_SHARE_TABS = ['link', 'embed', 'social'];
class ShareLinkContainer extends Component {
constructor(props) {
@@ -269,7 +271,7 @@ class ShareLinkContainer extends Component {
activeTab,
} = this.state;
const embedValue = this.getPermalink(true);
- const embedIframeHTMLCode = wrapWithIframe(embedValue);
+ const embedIframeHTMLCode = wrapWithObject(embedValue);
return (
<TabPane tabId="embed" className="share-tab-embed">
@@ -330,7 +332,7 @@ class ShareLinkContainer extends Component {
{this.renderNavTabs()}
<TabContent activeTab={activeTab}>
{this.renderLinkTab()}
- {/* {this.renderEmbedTab()} */}
+ {this.renderEmbedTab()}
{this.renderSocialTab()}
</TabContent>
</div>
diff --git a/web/js/modules/link/util.js b/web/js/modules/link/util.js
index e8352c4a8..b42c6906a 100644
--- a/web/js/modules/link/util.js
+++ b/web/js/modules/link/util.js
@@ -109,3 +109,5 @@ export function getPermalink(queryString, selectedDate, isEmbed) {
}
export function wrapWithIframe(value) { return `<iframe src="${value}" role="application" sandbox="allow-modals allow-scripts allow-same-origin allow-forms allow-popups" width="100%" height="100%" allow="fullscreen; autoplay;" loading="lazy"></iframe>`; }
+
+export function wrapWithObject(value) { return `<object type="text/html" data="${value}" width="100%" height="100%" role="application"></object>`; }