Google Earth ee.data.authenticateViaPopup is blocked by persistent pop-ups
P粉124890778
2023-08-18 14:14:26
<p>When I implement the example of Google Authentication in the Google Earth JavaScript API, the popup login window is blocked and the following message is displayed on the console: </p>
<p>Cross-Origin-Opener-Policy policy will prevent window.closed calls.
Lv @ cb=gapi.loaded_0?le=scs:406</p>
<p>I tried adding response headers: </p>
<pre class="brush:php;toolbar:false;">var xhr = new XMLHttpRequest();
xhr.open('POST', url);
xhr.setRequestHeader('Cross-Origin-Opener-Policy', 'same-origin-allow-popups');
xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
xhr.send();
var head1 = document.getElementsByTagName('head')[0];
var meta1 = document.createElement('meta');
meta1.httpEquiv = 'Permissions-Policy';
meta1.content = 'ch-ua-form-factor=()';
head1.appendChild(meta1);</pre>
<p>I added the permissions policy because I was getting a warning. </p>
<p>This script has no effect. </p>
<p>Please help. </p>
The pop-up window was closed because I was already logged in. ee.data.authenticateViaOauth() doesn't work.