What's wrong with front-end jsonp-based development?

you can call asynchronous interfaces across domains through jsonp. What"s the problem if all or a large number of pages request data through jsonp?

I am a front-end, and I am often asked by my back-end developer colleagues that if you have transferred interface A (jsonp), across domains, then you can adjust interface B yourself, so I won"t encapsulate it for you. I certainly don"t recommend it, but when I think about it, I don"t know what the real problem is. Hope that Daniel who has studied it can analyze it from http or performance, thank you!

Mar.25,2021

it is recommended to deal with it in the background

  1. if a third-party API is called, it is recommended to deal with it in the background
  2. if the local environment, vue, react can configure the agent
  3. if you want to debug locally, it is best for Google browser to cross-domain

if there is any problem, you may need to find out why the browser made the same origin policy in the first place, and whether it is easy for everyone to develop without it.
by the way, if it's not the old system, just use cors now.


jsonp is get in nature, and get has a length limit. When the amount of data is too large, it will not be able to complete the submission normally.


the biggest problem cannot be used post based on jsonp. You can expose all the parameters. Including your login password account ok, if you want to use it!

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bf18f6-31d75.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bf18f6-31d75.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?