This question already has answers here:
Is right click a Javascript event?
(22 answers)
How to add a custom right-click menu to a webpage?
(21 answers)
Closed 9 years ago.
I would need to know if the context menu has been opened for my javascript program.
I have to execute a function only when I see that the context menu is opened.
Could you help me?
Regards.
document.addEventListener('contextmenu', function() {
console.log('ya right');
});
The above snippet logs ya right when the user right clicks.
Related
This question already has answers here:
Javascript Bring window to front if already open in window.open?
(8 answers)
Closed 5 years ago.
I got a javascript that fills in the modal html. I would like after that to maximize the window if it is minimized or to focus that tab if it is maximized and not focused.
Anybody knows how to do it?
Note: I'd like it to also work in older IE if possible if not I am pleased with the new one also
Thank you all!
window.open("https://www.google.com");
This will open a new window and you can change the url to suit your needs
This question already has answers here:
How to Detect Browser Window /Tab Close Event?
(8 answers)
Closed 7 years ago.
I know about window.onbeforeunload, but that also executes when the user clicks on a link or refreshes the page, while I want my function to only execute when the browser or tab is closed. Is there a way to do that?
AFAIK the only options are unload and onbeforeunload so I would say the answer to your questions is "no".
https://developer.mozilla.org/en-US/docs/Web/Events/unload
This question already has answers here:
Making a window pop under in chrome
(8 answers)
Closed 7 years ago.
I want to open a pop-under window on click, but I want to open it behind the current window.
I google this and found nothing useful about my problem.
Is there a way to do it?
Perhaps a simple path setting is what you need. Use this within a javascript sequence:
path = window.document.URL;
window.open(path,"_self");
This question already has answers here:
Identifying Between Refresh And Close Browser Actions
(13 answers)
How can I detect browser tab refresh or close using javascript [duplicate]
(3 answers)
Closed 7 years ago.
I want to do somethin when users closing my webs. So I'd done like this:
window.onbeforeunload = function(){
#do something
}
But it's dispoint that I can't know the uers is doing close or not, because it's also can be refresh (like F5);
do anybody would like to help me?
This question already has answers here:
How can I close a browser window without receiving the "Do you want to close this window" prompt?
(18 answers)
Closed 8 years ago.
When we open a form in a new window, we would like to click a button to close the window without alert box.
Is it possible?
Any help is appreciated.
Thanks alot
if you are talking about window.open() function then just try to use window.close()