@ssports_fe/ssutils
Version:
21 lines (18 loc) • 507 B
JavaScript
const typeOf = require('./_typeOf');
/**
*
* @desc iframe父级页面跳转
* @param 跳转的页面地址 {String} url
*/
const reloadIframeUrl = url => {
if (url && typeOf(url) === 'string') {
if (window.top !== window.self) {
window.top.location.href = url;
} else {
window.location.href = url;
}
} else {
console.error('请检查参数,参数必须为字符串!');
}
};
module.exports = reloadIframeUrl;