# خطأ CSP عند استخدام مكتبة طرف ثالث في إضافة

**URL:** <https://meta.discourse.org/t/csp-error-when-using-third-party-library-in-plugin/271498>\
**Category:** Development\
**Created:** [13 يوليو 2023، 4:03ص UTC](https://meta.discourse.org/t/csp-error-when-using-third-party-library-in-plugin/271498 "2023-07-13T04:03:06Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![peter.be](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/peter.be/32/314243_2.png) [@peter.be](https://meta.discourse.org/u/peter.be)\
**Post date:** [13 يوليو 2023، 4:03ص UTC](https://meta.discourse.org/t/csp-error-when-using-third-party-library-in-plugin/271498/1 "2023-07-13T04:03:07Z")

</div>

بعد العديد من المحاولات والمقاربات المختلفة، تمكنت من تحميل مكتبة طرف ثالث بنجاح لاستخدامها في المكون الإضافي الخاص بي.  
تقع المكتبة تحت `public/javascripts/some-library.js`.  
في وحدة التحكم الخاصة بي، يمكنني تحميل البرنامج النصي بنجاح عبر:

```js
loadScript("/plugins/my-plugin/javascripts/some-library.js")

```

في بعض الأحيان في هذا الملف، تنشئ المكتبة كائنات Blob وتعينها للمتغيرات التي يتم استخدامها. على سبيل المثال:

```js
var A=URL.createObjectURL(new Blob(['\n\tsome code snippet...'],{type:"application/javascript"}))

```

وفي كل مرة أحاول فيها استخدام المكتبة في كود المكون الإضافي الخاص بي، أحصل على:  
`Refused to load the script 'blob:http://localhost:4200/f33a6788-a853-4286-883a-48cb8e2c9cc1' because it violates the following Content Security Policy directive: "script-src http://localhost:4200/assets/ etc etc...`  
ما هي أفضل طريقة للتحايل على هذا؟  
شكراً جزيلاً على أي مساعدة أو توجيهات!

---

_[View the full topic](https://meta.discourse.org/t/csp-error-when-using-third-party-library-in-plugin/271498)._
