'Azure App Insights - Script error: The browser's same-origin policy prevents us from getting the details of this exception

I have created an Angular application where I have integrated Azure App Insights. The problem is when I land on a specific page it logs the below error in app insights

Script error: The browser's same-origin policy prevents us from getting the details of this exception. Consider using the 'crossorigin' attribute

I have many users accessing the same page, but it occurs only to some users. I know we can solve it using crossorigin attribute but I want to know why it's occuring only for some users.

Let me know if you have any thoughts.



Solution 1:[1]

To minimize or avoid the error, You can visit this MSFT doc of Sampling in Application Insights.

  • <InitialSamplingPercentage>100</InitialSamplingPercentage> : When the app is first started, the amount of telemetry to sample.

  • <ExcludedTypes>Trace;Exception</ExcludedTypes> : A semi-colon delimited list of types that you don't wish to be subject to sampling. Dependency, Event, Exception, PageView, Request, and Trace are all recognised types.

References :

  1. No way to suppress cross-domain script errors from logging?
  2. How to exclude Exception and Error logging from sampling in Application Insights in .NET Core 2.1?,
  3. Filter and preprocess telemetry in the Application Insights SDK
  4. Case Study: Adding Application Insights to a website

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 SuryasriKamini-MT