I have Exit button in my page, when ever i clicked on that button,current browser tab should be closed.I wrote below code this is working in IE browser only but it needs to work in Chrome and Firefox.
Please help me.
Code:
window.top.close();
You can't do that in other browsers. If you check the console you will see:
Scripts may close only the windows that were opened by it
Related
I am using as2 flash cs5. I have made many games and added getURL("javascript:window.close();") to exit window. it works in enternet explorer but not working now on google chrome and firefox mozilla.
when i press the button it says :
Scripts may not close windows that were not opened by script.
please help
You can only do this in firefox by adding following preferences into about:config area.
dom.allow_scripts_to_close_windows
setting this to true would allow you to close apps with script.
I am using that kind of tab to built my website, everything works but as soon as I open Firebug I can not click on the tabs anymore, they do not seem to switch anymore (I don't get any errors) (Chrome and IE work fine all the time).
And on StackOverflow I can not press the login button anymore, the tag auto complete doesn't work as well (I have to close and reopen my browser and keep the firebug closed).
I have no active breakpoints.
My software:
Firefox 38.0.5
Firebug 2.0.11
Maybe you have some ideas?
I've been trying to get a simple "print" link on my recent page to work. I set up a simple fiddle to show what I'm trying to do.
http://jsfiddle.net/bladnman/4Ux9U/
For some reason Chrome is complaining about:
TypeError: Property 'print' of object [object Window] is not a function
You know, this very very simple kind of thing. Been doing it for years:
Click me to Print
UPDATE #1:
Many users have reported that this is working fine for them on Chrome. I still see nothing but the error reported.
I did want to add my environment:
Version: 21.0.1180.89
OS: OSX Mountain Lion
UPDATE #2:
Big thanks to Arjen! It turns out that an extension (Better Popup Blocker) changed the DOM enough as to null out the "print" function on Window.
Thanks again everyone!
I didn't have any issues with it, but I was able to reproduce the problem you were having on Windows 7 running Chrome 21.0.1180.89 by enabling my popup blocker (I use Better Popup Blocker - Chrome Web Store) for jsfiddle.
If you are using a popup blocker, try disabling it for jsfiddle / the site you are working with.
The Adblocker chrome extension in Mojave stops window.print() as well.
I have an alert box, and when I run that code in Firefox, no matter what program I have over firefox, firefox appears with the pop-up automatically over other programs open.
This however, does not work in Chrome.
What gives? Would this be a perference change or this there a line of code that says focus on this window.
I used
window.blur();
window.focus();
and that fixed my problem :)
The implementation of alert is browser specific. Unfortunately there is not line of javascript code to change this.
If you want to have customizable (and working the same in every browser) alert window, use jquery UI.
Note: It will be over the actual page, not over the (other) window.
Response To:
Opening Popup Window is not working in firefox and google chrome
Hi,I have similar code in above question.My code works fine in IE.
this.parent.window.showModalDialog('Counter.aspx', '',
'dialogHeight:170px;dialogWidth:150px;status:no;scroll:no;edge:sunken;toolbar:0;center:on;help:off;unadorned:yes;');
What can i do about this code in order to open this window in Google Chrome browser ?
Thanks for any assistance
Myra
showModalDialog works in chrome(its not truly modal though). the problem could be that it is blocking them. Chrome's minimalistic design doesnt even tell you that some times. try adding an exception for you current website.
you can find it under -
Options->Under The Hood Tab-> Content Settings Button -> Popups Tab -> Exceptions button