We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
querySelector
1 parent 9b74870 commit 9abca91Copy full SHA for 9abca91
packages/tracing/src/browser/browsertracing.ts
@@ -268,6 +268,13 @@ export function extractTraceDataFromMetaTags(): Partial<TransactionContext> | un
268
269
/** Returns the value of a meta tag */
270
export function getMetaContent(metaName: string): string | null {
271
- const el = getGlobalObject<Window>().document.querySelector(`meta[name=${metaName}]`);
272
- return el ? el.getAttribute('content') : null;
+ const globalObject = getGlobalObject<Window>();
+
273
+ // DOM/querySelector is not available in all environments
274
+ if (globalObject.document && globalObject.document.querySelector) {
275
+ const el = globalObject.document.querySelector(`meta[name=${metaName}]`);
276
+ return el ? el.getAttribute('content') : null;
277
+ } else {
278
+ return null;
279
+ }
280
}
0 commit comments