我想單擊「註銷」按鈕關閉Internet Explorer的當前選項卡。這是一個在我的web應用程序中實現的新功能。我的應用程序僅支持Internet Explorer。註銷按鈕所在的頁面是多個window.close()頁面的組合。如何在vbscript或javascript中關閉Internet Explorer的當前選項卡
我用下面的代碼在VBScript,關閉瀏覽器Internet Explorer的當前窗口:
if(window.opener = Empty) then
dim x
x = "<%=Request.Browser.MajorVersion%>"
if(x="6") then
window.parent.opener = "x"
window.parent.close
else
'I need code for closing the tab here for IE7
end if
end if
我曾用「<%= Request.Browser.MajorVersion%>」來獲取互聯網版本探險家。它是IE6然後代碼工作正常,因爲IE6中沒有選項卡功能,但如何關閉IE7的當前選項卡。請在這種情況下幫助我,以便我可以關閉IE7的當前標籤。 Thnaks提前!
我想你只能關閉窗口或標籤,你「自己」用JavaScript。你有沒有嘗試將window.opener設置爲self,然後使用window.close()? – box86rowh
是的,我已經嘗試了通過設置window.opener =自我...但是沒有工作:( –
@ box86rowh: - 我認爲這是正確的你說什麼,但你絕對可以關閉在IE7選項卡也。張貼我的答案,併爲我工作得很好。:) –