Restore "don't run SP script on iframe (368)" + lint/format (#373)
This commit is contained in:
parent
406d91948d
commit
56ecdec2cb
1 changed files with 15 additions and 3 deletions
|
@ -332,6 +332,18 @@ function App(props: Props) {
|
||||||
|
|
||||||
// add secure privacy script
|
// add secure privacy script
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
function inIframe() {
|
||||||
|
try {
|
||||||
|
return window.self !== window.top;
|
||||||
|
} catch (e) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inIframe()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const script = document.createElement('script');
|
const script = document.createElement('script');
|
||||||
script.src = securePrivacyScriptUrl;
|
script.src = securePrivacyScriptUrl;
|
||||||
script.async = true;
|
script.async = true;
|
||||||
|
@ -359,7 +371,7 @@ function App(props: Props) {
|
||||||
|
|
||||||
// haven't done a gdpr check, do it now
|
// haven't done a gdpr check, do it now
|
||||||
if (gdprRequired === null) {
|
if (gdprRequired === null) {
|
||||||
(async function() {
|
(async function () {
|
||||||
const response = await fetch(getLocaleEndpoint);
|
const response = await fetch(getLocaleEndpoint);
|
||||||
const json = await response.json();
|
const json = await response.json();
|
||||||
const gdprRequiredBasedOnLocation = json.data.gdpr_required;
|
const gdprRequiredBasedOnLocation = json.data.gdpr_required;
|
||||||
|
|
Loading…
Reference in a new issue