In my MVC application being developed for sales, I have a button which opens a web page which doesn't allow iframe to open in a new tab. So, when the sales agent use this button, they often don't close the tabs opened by the application and in the end of the day, there is 20-30 of open tabs. So, I was wondering if there is a script which I can add to a new button which could close:
- Either the complete browser with all tabs in it so they can start fresh or
- Close all other tabs without affecting the current tab.
In the view, I have
HTML
<input type="submit" onclick="return OpenInNewTab('http://test.com');" name="command" value="nonIframe" background-image:url(../images/URL/Test.png);" class="submit" />
Javascript
//Function OpenInNewTab
function OpenInNewTab(url) {
var win = window.open(url, '_blank');
win.focus();
return false;
}
I was playing with this script, but it only closes the current tab. I want the current tab to be open and close all other tabs or close the entire browser itself.
Javascript
<script language="JavaScript">
function closeIt() {
close();
}
</script>
HTML
<center>
<form>
<input type=button value="Close Window" onClick="closeIt()">
</form>
</center>
Any suggestions would be really appreciated.
Thank You
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…