# Wie man JavaScript-Skript vor dem Tag "\< / body \>" einbettet

**URL:** <https://meta.discourse.org/t/how-to-embed-javascript-script-in-front-of-body-tag/279159>\
**Category:** Development\
**Created:** [15. September 2023 um 14:34 UTC](https://meta.discourse.org/t/how-to-embed-javascript-script-in-front-of-body-tag/279159 "2023-09-15T14:34:16Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![Lhc\_fl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lhc_fl/32/268115_2.png) [@Lhc\_fl](https://meta.discourse.org/u/Lhc_fl)\
**Post date:** [16. September 2023 um 15:41 UTC](https://meta.discourse.org/t/how-to-embed-javascript-script-in-front-of-body-tag/279159/7 "2023-09-16T15:41:15Z")

</div>

~~ 

Sie können die discourse plugin-api verwenden.  
You can use the discourse plugin api.

 

```plaintext
<script type="text/discourse-plugin" version="0.8">
api.decorateCookedElement((elem, helper) => {
    const player = new Plyr('video');
}, {id: "beauitfy-video"})
</script>

```

 ~~

Ah, Sie müssen es nur einmal laden? Dann tun Sie so, als hätte ich es nicht gesagt.  
Ah, you only need to load once? Then pretend I didn’t say it

> [@zengyunsi](#):
>
> 只能放在body结尾

Das macht keinen Unterschied. Haben Sie keinen Event-Listener?  
It makes no difference. Don’t you have an eventListener?

---

_[View the full topic](https://meta.discourse.org/t/how-to-embed-javascript-script-in-front-of-body-tag/279159)._
