nicolasbeauvais / vue-social-sharing

A renderless Vue.js component for sharing links to social networks, compatible with SSR
https://nicolasbeauvais.github.io/vue-social-sharing/
MIT License
1.39k stars 196 forks source link

Uncaught DOMException: An attempt was made to break through the security policy of the user agent. #354

Open hasanrazahabi opened 7 months ago

hasanrazahabi commented 7 months ago

I am getting this issue anyone other has such kind of issue please let me know how to fix it.

wty302857194 commented 7 months ago

Have you solved it yet?

hasanrazahabi commented 7 months ago

Not yet still looking to find it

abdellatif-147 commented 7 months ago

Has anyone solved this problem ?

Lixus commented 7 months ago

I get the same error, and did not find any info on it.

liugezhou commented 6 months ago

I get the same error, and did not find any info on it.

rllovetindicator commented 6 months ago

Got same error, and did not find any info on it.

edencorbin commented 5 months ago

Same error no info on it.

wadguk commented 5 months ago

same here

valenIndovino commented 4 months ago

same here. thanks.

FADL285 commented 4 months ago

Has anyone found a solution to this problem?

AvramovSV commented 3 months ago

Same problem

Qwoxa commented 3 months ago

A possible workaround

Setting Up a Reference and Tracking the "Open" Event for ShareNetwork

First, you need to create a ref for the ShareNetwork component and set up an event listener to track when it opens. Also, you need to assign an event listener to the open event, which triggers the runWorkaround function (will be described in the next paragraph):

const shareNetworkRef = ref(null);

<template>
  <ShareNetwork ref="shareNetworkRef" @open="runWorkaround" />
</template>

Implementing the Workaround Function

Due to security restrictions, the popupWindow object cannot be accessed . To address this, we've implemented a workaround that involves clearing this variable and stopping the interval, which checks if the popup has been closed:

function runWorkaround(index: number): void {
  if (shareNetworkRef.value === null) return;

  clearInterval(shareNetworkRef.value.popupInterval);
  shareNetworkRef.value.popupWindow = undefined;
}

Important Consideration

By applying this workaround, you will lose the ability to monitor the 'close' event of the ShareNetwork component. It's important to note that in the current implementation, tracking the 'close' event is not functioning correctly either. Therefore, although this workaround has a limitation, it addresses the existing issue by providing a temporary solution.

Haunth commented 3 months ago

A possible workaround

Setting Up a Reference and Tracking the "Open" Event for ShareNetwork

First, you need to create a ref for the ShareNetwork component and set up an event listener to track when it opens. Also, you need to assign an event listener to the open event, which triggers the runWorkaround function (will be described in the next paragraph):

const shareNetworkRef = ref(null);

<template>
  <ShareNetwork ref="shareNetworkRef" @open="runWorkaround" />
</template>

Implementing the Workaround Function

Due to security restrictions, the popupWindow object cannot be accessed . To address this, we've implemented a workaround that involves clearing this variable and stopping the interval, which checks if the popup has been closed:

function runWorkaround(index: number): void {
  if (shareNetworkRef.value === null) return;

  clearInterval(shareNetworkRef.popupInterval);
  shareNetworkRef.popupWindow = undefined;
}

Important Consideration

By applying this workaround, you will lose the ability to monitor the 'close' event of the ShareNetwork component. It's important to note that in the current implementation, tracking the 'close' event is not functioning correctly either. Therefore, although this workaround has a limitation, it addresses the existing issue by providing a temporary solution.

Thank Your so much. I fixed this problem. Buts you need change your function like this: ` function runWorkaround(index: number): void { if (shareNetworkRef.value === null) return;

clearInterval(shareNetworkRef.value.popupInterval); shareNetworkRef.value.popupWindow = undefined; } ` Because shareNetworkRef is ref

Qwoxa commented 3 months ago

A possible workaround

Setting Up a Reference and Tracking the "Open" Event for ShareNetwork

First, you need to create a ref for the ShareNetwork component and set up an event listener to track when it opens. Also, you need to assign an event listener to the open event, which triggers the runWorkaround function (will be described in the next paragraph):

const shareNetworkRef = ref(null);

<template>
  <ShareNetwork ref="shareNetworkRef" @open="runWorkaround" />
</template>

Implementing the Workaround Function

Due to security restrictions, the popupWindow object cannot be accessed . To address this, we've implemented a workaround that involves clearing this variable and stopping the interval, which checks if the popup has been closed:

function runWorkaround(index: number): void {
  if (shareNetworkRef.value === null) return;

  clearInterval(shareNetworkRef.popupInterval);
  shareNetworkRef.popupWindow = undefined;
}

Important Consideration

By applying this workaround, you will lose the ability to monitor the 'close' event of the ShareNetwork component. It's important to note that in the current implementation, tracking the 'close' event is not functioning correctly either. Therefore, although this workaround has a limitation, it addresses the existing issue by providing a temporary solution.

Thank Your so much. I fixed this problem. Buts you need change your function like this: ` function runWorkaround(index: number): void { if (shareNetworkRef.value === null) return;

clearInterval(shareNetworkRef.value.popupInterval); shareNetworkRef.value.popupWindow = undefined; } ` Because shareNetworkRef is ref

Oh, missed it. Thank you, fixed.

Darshan0092 commented 3 months ago

I am using Javascript and Vue 3 Version:- This is Working For me.

index is not required const shareNetworkRef = ref(null);

const runWorkaround = (index) => { if (shareNetworkRef.value === null) return;

clearInterval(shareNetworkRef.value.popupInterval); shareNetworkRef.value.popupWindow = undefined; }

suangencong commented 2 months ago

A possible workaround

Setting Up a Reference and Tracking the "Open" Event for ShareNetwork

First, you need to create a ref for the ShareNetwork component and set up an event listener to track when it opens. Also, you need to assign an event listener to the open event, which triggers the runWorkaround function (will be described in the next paragraph):

const shareNetworkRef = ref(null);

<template>
  <ShareNetwork ref="shareNetworkRef" @open="runWorkaround" />
</template>

Implementing the Workaround Function

Due to security restrictions, the popupWindow object cannot be accessed . To address this, we've implemented a workaround that involves clearing this variable and stopping the interval, which checks if the popup has been closed:

function runWorkaround(index: number): void {
  if (shareNetworkRef.value === null) return;

  clearInterval(shareNetworkRef.popupInterval);
  shareNetworkRef.popupWindow = undefined;
}

Important Consideration

By applying this workaround, you will lose the ability to monitor the 'close' event of the ShareNetwork component. It's important to note that in the current implementation, tracking the 'close' event is not functioning correctly either. Therefore, although this workaround has a limitation, it addresses the existing issue by providing a temporary solution.

Thank Your so much. I fixed this problem. Buts you need change your function like this: function runWorkaround(index: number): void { if (shareNetworkRef.value === null) return; clearInterval(shareNetworkRef.value.popupInterval); shareNetworkRef.value.popupWindow = undefined; } Because shareNetworkRef is ref

Oh, missed it. Thank you, fixed.

VUE2 NUXT vue-social-sharing . Error : Uncaught DOMException: An attempt was made to break through the security policy of the user agent. May I how to handle this issue? Thank you for your support.

Uncaught DOMException: An attempt was made to break through the security policy of the user agent. at ie (https://www.XXXX.com/_nuxt/a1925a6.js:2:12130) at Object.get [as popupWindow] (https://www.XXXX.com/_nuxt/a1925a6.js:2:10906) at vo.get [as popupWindow] (https://www.XXXX.com/_nuxt/a1925a6.js:2:40591) at https://www.XXXX.com/_nuxt/dadf402.js:2:64148

craigh411 commented 2 months ago

A possible workaround

Setting Up a Reference and Tracking the "Open" Event for ShareNetwork

First, you need to create a ref for the ShareNetwork component and set up an event listener to track when it opens. Also, you need to assign an event listener to the open event, which triggers the runWorkaround function (will be described in the next paragraph):

const shareNetworkRef = ref(null);

<template>
  <ShareNetwork ref="shareNetworkRef" @open="runWorkaround" />
</template>

Implementing the Workaround Function

Due to security restrictions, the popupWindow object cannot be accessed . To address this, we've implemented a workaround that involves clearing this variable and stopping the interval, which checks if the popup has been closed:

function runWorkaround(index: number): void {
  if (shareNetworkRef.value === null) return;

  clearInterval(shareNetworkRef.value.popupInterval);
  shareNetworkRef.value.popupWindow = undefined;
}

Important Consideration

By applying this workaround, you will lose the ability to monitor the 'close' event of the ShareNetwork component. It's important to note that in the current implementation, tracking the 'close' event is not functioning correctly either. Therefore, although this workaround has a limitation, it addresses the existing issue by providing a temporary solution.

For anybody still using the Option API, you can do the same thing like this:

methods: {
  runWorkaround() {
    if (this.$refs.shareNetworkRef === null) return;

      clearInterval(this.$refs.shareNetworkRef.popupInterval);
      this.$refs.shareNetworkRef.popupWindow = undefined;
  }
},
nayan-7span commented 6 days ago

I am using Javascript and Vue 3 Version:- This is Working For me.

index is not required const shareNetworkRef = ref(null);

const runWorkaround = (index) => { if (shareNetworkRef.value === null) return;

clearInterval(shareNetworkRef.value.popupInterval); shareNetworkRef.value.popupWindow = undefined; }

Index is needed when we are working with multiple sharing. I resolved the issue with.

  console.log("shared network ref", shareNetworkRef.value[index]);
  if (shareNetworkRef.value[index] === null) return;

  clearInterval(shareNetworkRef.value[index].popupInterval);

  shareNetworkRef.value[index].popupWindow = undefined;
};