JS cross-origin post parameters and control the current page display

Source: Internet
Author: User

AJAX can post parameters, but cannot cross-Origin
Use the src attribute of the script tag. the src attribute of the image object can be cross-origin, but only get parameters can be used.
There are only two methods to use JS cross-origin:
1.Local Domain proxy: Ajax sends a post parameter to a file in the current domain. The file then interacts with files in other domains.
2.IFRAME: JS dynamically generates a hidden IFRAME, inserts a form in this IFRAME, uses js to submit the form to a file in another domain, receives the submitted file, and outputs Js, use parent in JS to operate the DOM object of the current page
Recently, a voting system has a question bank that can call this question bank in other systems and present these questions to users. These questions include single choice, multiple choice, and question answering. When other systems submit the voting results to the voting system, because the two systems may not be in the same domain, cross-origin submission is required because the answer to the question may be long, the URL length is exceeded, so the POST method is used. To enable cross-origin post submission to be performed without user perception, JS is required. JS cross-origin post submission, including local domain proxy and IFRAME. The method of proxy in this domain is complicated to implement. If the voting interface system is changed, you need to write proxy in the new system. IFRAME methods have good reusability. However, the construction process of the post parameter is completely visible, and hackers may initiate attacks by submitting the parameter cyclically.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.