我试图关闭子窗口,如果主机名是相同的父母和孩子,但其window.opener.location.indexOf()函数问题
<script type="text/javascript">
$(document).ready(function() {
if (window.opener) {
if (window.opener.location.indexOf(document.location.hostname) != -1) {
window.opener.location = window.location;
window.close();
}
}
});
</script>
,并收到此错误
Error: window.opener.location.indexOf is not a function
Source File: https://example.com/default
Line: 100
哦~~!感谢这一点。 :) +1。 – 2011-12-24 06:00:54