I have a requirement to close the complete browser windows instead of closing a particular tab which I have opened.
I am able to close the tab which I have opened using javascript, but need to close the complete window.
It is not possible to close the entire browser via JavaScript
Related
How to use Angular's $window to open multiple links at once? The browser seem to block the pop up, is there anywhere to overcome that issue?
http://plnkr.co/edit/m8m2I9dqE2kF1H1nzxJT?p=preview
$scope.links = [
{'link':'www.google.com'},
{'link':'www.yahoo.com'},
{'link':'www.bing.com'}
];
So yes. The problem is that the windows are being opened to another domain -- so the browser will block the windows. The solution is to open the window at a page in your domain, and pass the url you want to go to and then have that page redirect to the page.
http://plnkr.co/edit/nAfQ4oHyCC22oSCFqMpH?p=info
This is not an issue. After dark days when spammers used popups for displaying advertisements, window.open() is blocked.
Pleas read
Allow window.open to open new window and not popup
Open page in new window without popup blocking
I am opening a popup after main window load.
Problem:
When user actually click on link the popup opens without complaining anything.
But when I am using Javascript call to click on href, I am getting popup blocker.
I am suspecting that, browser identifies that, popup is opening without any actual operation by user and that's why it is blocking popup.
In herf, I am calling a javascript method to open the popup.
I searched all the questions regarding opening popup and simulating the click like this, these works fine to simulate the click but still getting popup blocker.
Is there any workaround to fool browser?
You can't fool the browser per-se in this scenario. You could however, launch a div as an overlay on the main window if that's an option.
I am trying to close a tab using JavaScript on Firefox. I went through a few older questions posted here on Stackoverflow and I understand that Firefox doesn't allow a tab to be closed using JavaScript unless the tab has been opened from JavaScript itself.
However, I could open a blank tab in place of the existing tab using
window.open('about:blank','_self','');.
My question is since the blank tab has been opened through JavaScript, why can't I close it using window.close();?
My question is since the blank tab has been opened through JavaScript
The tab wasn't opened with JS. A window.open call just used the name of an existing tab so the document was loaded there instead of opening a new window.
I search a lot but could not figured it out.
Is it possible to open a new window with tab enabled using window.open() method?.
The way chrome context menu "open link in new window" works.
The browser decides on its own how links will open. Sometimes a user can configure how links are to be opened, but the web page cannot do this.
using an anchor tag you can set the target attribute to have some control over where the link opens. Other than that, this behavior is up to the browser and user and cannot be controlled by javascript.
Use this code
window.open("http:.//www.google.com","DemoName",'scrollbars=1,height=650,width=1050');
I am using the facebook dialog feed to allow the user to post a message to their wall.
You must provide a redirect_url for the page to redirect to after it has submitted,
I want on the page it redirects to to have some code which simply closes the windows.
I tried using
<html><head><title>Close</title></head><body onload="window.close();"></body></html>
and
<html><head><title>Close</title></head><body onload="self.close();"></body></html>
but to no effect.
(note that my testing is simply me opening a new tab with this url, could that be the issue?)
You can only close windows with javascript if they were opened with javascript.
Otherwise, try looking at this question: How can I close a browser window without receiving the "Do you want to close this window" prompt?