How can I tell if a remotely-controlled frame has completely loaded?
I am creating an interface for a lending client that will help automate the process of completing a multi-page loan application in an external domain, and am looking for some best practices for completing the task.
Background:
The customer has a website that allows applicants to fill out a loan application. Depending on a number of criteria, the loan is then routed to one of a number of financing partners (think Lending Tree). Most of the time the info is submitted to external partners via SOAP or REST API's, but they have a new partner that doesn't have a published API. The customer needs a way to complete the loan application on the partner site with as little manual data entry as possible.
In order to get around browser XSS restrictions, I've set up a proxy server with the following setup:
- partnerA.mydomain.com is reverse proxied to partnerA.com (e.g. a request to partnerA.mydomain.com is transparently proxied to partnerA.com)
- partnerA.mydomain.com/controlpanel/* is routed to mydomain.com
I've prototyped a framed inter开发者_StackOverflow社区face, with a top frame served by partnerA.mydomain.com/controlpanel/index and the bottom frame served by partnerA.mydomain.com. Because both frames are in the same FQDN and port, I can use javascript in the top frame (under my control) to manipulate the bottom frame (partner A's website).
My goal is to allow a customer service rep to push a button in the top frame (e.g. "Complete Application") and have it populate and complete the multi-page form in the bottom frame, one screen at a time. Filling the bottom form is trivial, but I'm looking for an elegant way to know after I've submitted a page that the frame has refreshed. I've tried attaching an onload event to the bottom frame with no success. I toyed with changing an attribute of the body (e.g. change body bgcolor from white to gray and then waiting for it to be white again) but it seems extremely klugy. What's a better way?
精彩评论