How to reliably submit an HTML form with JavaScript?

后端 未结 7 1590
面向向阳花
面向向阳花 2020-12-13 20:33

Is there a way to submit an HTML form using JavaScript that is guaranteed to work in all situations?

I elaborate. The common approach seems to be:

fo         


        
7条回答
  •  半阙折子戏
    2020-12-13 20:59

    Submiting a form using JavaScript cannot by design be safe.

    Your users can browse your web site on their phone, have disabled JavaScript, tweaked the source of your page, or using Lynx.

    In any case, for accessibility purposes, you will need the good old HTML submit button and some input checks on the server side.

提交回复
热议问题