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:
- CRM
- e-Commerce
- 회계
- 재고 관리
- PoS
- Project
- MRP
신고된 질문입니다
1
회신
2230
화면
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
관련 게시물 | 답글 | 화면 | 활동 | |
---|---|---|---|---|
|
1
10월 18
|
3738 | ||
|
2
12월 22
|
6253 | ||
|
5
1월 22
|
11877 | ||
|
1
8월 16
|
5236 | ||
|
1
5월 25
|
8427 |