diff --git a/demo/widget-tabs.html b/demo/widget-tabs.html
new file mode 100644
index 00000000..7d75f83e
--- /dev/null
+++ b/demo/widget-tabs.html
@@ -0,0 +1,39 @@
+
+
+
+ Widget example
+
+
+
+
+
+ A typeform widget will load below
+
+
+
+
+
+
+
+
+
diff --git a/package.json b/package.json
index 04c8bce8..26a4a54a 100644
--- a/package.json
+++ b/package.json
@@ -6,7 +6,7 @@
"license": "LGPL-3.0-only",
"repository": {
"type": "git",
- "url": "https://github.com/Typeform/embed.git"
+ "url": "git@github.com:Typeform/embed.git"
},
"main": "build/lib.pure.js",
"module": "build/lib.pure.js",
diff --git a/src/core/features/google-analytics-instance-sharing.js b/src/core/features/google-analytics-instance-sharing.js
index 1bbce8dd..b452b50b 100644
--- a/src/core/features/google-analytics-instance-sharing.js
+++ b/src/core/features/google-analytics-instance-sharing.js
@@ -5,13 +5,17 @@ const setupGoogleAnalyticsInstanceSharingFeature = (iframeRef, embedId) => {
if (gaObject === undefined || gaObject === null) {
// eslint-disable-next-line no-console
- console.error(`Whoops! You enabled the shareGoogleAnalyticsInstance feature but the google analytics object has not been found.
+ console.error(`Whoops! You enabled the shareGoogleAnalyticsInstance feature but the google analytics object has not been found.
Make sure to include Google Analytics Javascript code before the Typeform Embed Javascript code in your page.`)
}
const sendGaIdMessage = (gaClientId) => {
const data = { embedId, gaClientId }
- setTimeout(() => iframeRef.contentWindow.postMessage({ type: 'ga-client-id', data }, '*'), 0)
+ setTimeout(() => {
+ if (iframeRef && iframeRef.contentWindow) {
+ iframeRef.contentWindow.postMessage({ type: 'ga-client-id', data }, '*')
+ }
+ }, 0)
}
gaObject((tracker) => {
diff --git a/src/core/views/widget.js b/src/core/views/widget.js
index fbd98998..6833ed22 100644
--- a/src/core/views/widget.js
+++ b/src/core/views/widget.js
@@ -246,7 +246,11 @@ class Widget extends Component {
return
}
- setTimeout(() => iframeRef.contentWindow.postMessage('embed-focus', '*'), 100)
+ setTimeout(() => {
+ if (iframeRef && iframeRef.contentWindow) {
+ iframeRef.contentWindow.postMessage('embed-focus', '*')
+ }
+ }, 100)
}
render() {