googlemaps / js-api-loader

Load the Google Maps JavaScript API script dynamically.
Apache License 2.0
351 stars 64 forks source link

SDK failing when loaded within iframe data URI #864

Open onassar opened 1 day ago

onassar commented 1 day ago

I'm getting the following error (as of today) in an iframe that makes use of the SDK:

common.js:214 Uncaught DOMException: Failed to read the 'sessionStorage' property from 'Window': Storage is disabled inside 'data:' URLs. at https://maps.googleapis.com/maps-api-v3/api/js/58/9/common.js:214:162

I'm using the following:

This then loads the following scripts:

It seems like this is happening because the SDK is failing when attempting to access the sessionStorage object. This appears to managed in a fault-tolerant way here, but not here.

It looks like the file just needs to be updated with a try/catch for instances where the sessionStorage object is not accessible.

Please advise if more information is needed.

usefulthink commented 1 day ago

At first glance, this looks like a valid issue, but it has nothing to do with the @googlemaps/js-api-loader project.

Instead, it would be best to report this in the issue tracker for the Maps JavaScript API. There seems to be a similar issue reported already that you can upvote: https://issuetracker.google.com/issues/373893062