Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
559 views
in Technique[技术] by (71.8m points)

javascript - window.close() in Mobile Browser not working

Is there an alternative way to close current tab using JS ? because window.close() is not working on Mobile browsers

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I have the same issue, i tried a lot of ways, but none can adapt to all devices. At last, I use the follow code, I really have no better way.

window.opener=null;
window.open('','_self');
window.close();
window.history.go(-1);
$(document.body).hide()

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...