I have a requirement where I have to submit same/similar data to 10-15 forms at a time. What I want to do is create a single page where all those forms are loaded, and fill in all known values automatically... The end user simply has to fill in the captchas shown for those 15 forms... Now I want each form's submission response to be loaded into an iframe within the same web page.
After this, I want a simple js to be loaded into each iframe, which reads some data from the parent document, as well as entire content of the response web page, an开发者_C百科d sends this using XMLHttpRequest to my web application. (The web application will parse through the content of form submission response, and see if the submission is successful or not).
The script that should be loaded into each iframe (within the main window) should read the iframe ID, some divs from the main window, and entire content of that iframe, and send it as a POST request to my web app.
Can such a scenario be implemented using Greasemonkey? Note that initially when the page with iframes is loaded, at that stage the iframes are blank- at this stage no data from iframes should be sent to my web app. Only after user submits all 10 forms, and the iframes are all loaded with respective form submission responses, now the js should send the data within each iframe to my web app.
One more question- currently I plan to use Google Chrome with appropriate runtime parameters to disable the same origin policy...But if the above scenario can be implemented using Greasemonkey script, then will I need to disable Same Origin Policy in Firefox also? Also, there is an extension in Firefox to add CORS enabler to a web page, can I combine that script with the code for above scenario, so that even if an iframe has different domain compared to main window, even then the data of each iframe is submitted?
1- Greasemonkey script load on every page and iframe that matches with your site filter. you can stop it from running for main window with this command:
if(window == window.top) return;
// else do the rest
2- You can access parent window and its content with window.parent. and access the iframe from Parent with .contentWindow property of your iframe. (if they have save domains)
精彩评论