When deploying a web system, a cross-domain problem was discovered, and the subsystem was embedded in the system with an IFRAME, causing the parent window to get the webservice and picture of the subsystem to discover cross-domain issues, as shown in:
Issue 1: Parent window gets subsystem objects across domains
reason: passing parameters directly in this way involves cross-domain issues
Parent Form pass Parameters:
Window. Monitorstationinfo.id= selectedrow.id; // parent Form pass Parameters
The subform Gets the parameters:
var pointid=window.parent.parent.monitorstationinfo.id// sub-form get parameters
Workaround: use cookies to pass parameters
Parent Form pass Parameters:
Document.cookie = "pointid=" + Escape (row. Monitorid); // Parent Forms Save parameters with cookies
The subform Gets the parameters:
var arr = Document.cookie.match (new RegExp ("(^|) Pointid= ([^;] *)(;|$)")); var pointid = unescape (arr[2]); // The subform Gets the parameters passed by the parent page through the cookie .
Issue 2: A picture of a subsystem source is displayed in the parent form across domains
When you click the picture in the Subwindow, the enlarged picture pops up in the parent window, as shown in:
before clicking:
After clicking
Actual effect:
Reason:
When using jquery to dynamically load enlarged images, I used the system's top-level document (Top.document) to manipulate the DOM's
This causes the enlarged picture to be displayed in the parent form resulting in cross-domain
Workaround:
let the magnified picture appear in the subsystem: when using jquery to dynamically load enlarged images, use the subsystem's document (Window.parent.document) to manipulate the DOM's
Cross-domain issues with different ports on the same web system