Hi, I am developing a custom module to create several pages on a website. Does anyone know how to load a js file for each page? I ask that because If you load on web.assets.frontend 1 file this is executed every time you navigate on every page.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- Müşteri İlişkileri Yönetimi
- e-Commerce
- Muhasebe
- Envanter
- PoS
- Project
- MRP
Bu soru işaretlendi
1
Cevapla
2224
Görünümler
Hi,
One thing you could do is check window.location.href == 'the page url' and then write the functions required for the page, or if there’s a specific class to identify the page, you can find it using jQuery and then write the code inside that.
if($(‘identifier)) {
function
}
Or you can add the script in the XML so that it only loads when the specific page loads.
Regards
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Üye Olİlgili Gönderiler | Cevaplar | Görünümler | Aktivite | |
---|---|---|---|---|
|
1
Eki 18
|
3735 | ||
|
2
Ara 22
|
6250 | ||
|
5
Oca 22
|
11876 | ||
|
1
Ağu 16
|
5235 | ||
|
1
May 25
|
8426 |