1.运用iframe(注重Iframe的高度默许150px,假如要转变iframe的高度,只能设置成详细的像素值,不能是百分比)
2.运用window.open()直接翻开外部窗口,在外部窗口中处置惩罚完成一切的操纵后回到本来的页面,本来的页面涌现一个确认是不是完成操纵的弹框。点击确认或许“cancel”以后接着挪用其他的接口。
3.运用window.open()在当前窗口翻开另一个窗口,在新开窗口中操纵完成以后,封闭该窗口,在当前窗口中监听新窗口什么时候封闭,一旦检测到窗口封闭就实行回调。
运用这类体式格局须要斟酌浏览器的跨域题目,在ie上假如运用window.open()翻开跨域了的窗口,window.open()是猎取不到window对象的。
detectCreditCardFilledOut: (callback, url, openWin) => {
let creditCarWin = null;
let s = null;
const stopF = () => {
clearInterval(s);
creditCarWin = null;
s = null;
callback();
};
const checkCloseWindowOrNot= () => {
if (creditCarWin != null && creditCarWin.closed) {
stopF();
}
};
const openCreditCard = () => {
try {
creditCarWin = openWin(url, 'CreditCard');
creditCarWin.focus();
runF();
} catch (e) {
Util.NotificationUtil('error', {
description: lang.openWindowError
})
}
};
const runF = () => {
s = setInterval(checkCloseWindowOrNot, 500);
};
openCreditCard();
},