File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
packages/tracing/src/browser Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -268,6 +268,13 @@ export function extractTraceDataFromMetaTags(): Partial<TransactionContext> | un
268
268
269
269
/** Returns the value of a meta tag */
270
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 ;
271
+ const globalObject = getGlobalObject < Window > ( ) ;
272
+
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
+ }
273
280
}
You can’t perform that action at this time.
0 commit comments