I have created an app named 'account'. In that created html form < account/account/www/signup.html >. if I put frappe.csrf_token in my script file. The console printed frappe is not defined.

How to import Frappe in html. I've not found anything related to that.

I have tried

headers: {
    "X-Frappe-CSRF-Token": frappe.csrf_token
},

like that I include the csrf token, but frappe error throws when I submit

frappe.exceptions.CSRFTokenError: Invalid Request
2

There are 2 best solutions below

0
On

you need to put your code inside frappe.ready function

frappe.ready(() => {
//your code
})
0
On

You need to extend web.html and then override that using your html