# تشغيل جافاسكريبت عند النقر على أي رابط صفحة، ولكن قبل تحميل محتوى الصفحة؟

**URL:** <https://meta.discourse.org/t/trigger-javascript-on-clicking-any-page-link-but-before-the-page-content-loads/167970>\
**Category:** Development\
**Created:** [22 أكتوبر 2020، 3:13م UTC](https://meta.discourse.org/t/trigger-javascript-on-clicking-any-page-link-but-before-the-page-content-loads/167970 "2020-10-22T15:13:01Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)\
**Post date:** [4 نوفمبر 2024، 10:28ص UTC](https://meta.discourse.org/t/trigger-javascript-on-clicking-any-page-link-but-before-the-page-content-loads/167970/4 "2024-11-04T10:28:41Z")

</div>

> [@جو، مشاركة:2، موضوع:167970، اسم المستخدم:Johani](#):
>
> ```plaintext
> // هذا يتم تفعيله مباشرة قبل الانتقال
> api.modifyClass("route:application", {
> pluginId: "some-name",
> actions: {
> willTransition() {
> 
> ```

يبدو أن هذا لا يتم تفعيله عند الدخول إلى موضوع من قائمة الموضوعات؟

لقد حاولت أيضًا إضافة واحد:

```plaintext
      api.modifyClass("route:topic", {
        pluginId: PLUGIN_ID,
        actions: {
          willTransition() {

```

ولكن هذا لا يتم تفعيله أيضًا.

---

_[View the full topic](https://meta.discourse.org/t/trigger-javascript-on-clicking-any-page-link-but-before-the-page-content-loads/167970)._
