Javascript window.open not focusing in Windows7 - javascript

I'm using IE8 in Windows7. When in Javascript I do window.open(....), the new window starts blinking in the taskbar. I want the new window to be displayed to the user and not hide in the taskbar.
I've tried:
var myWindow = window.open(.....);
myWindow.focus();
But still it starts blinking in the taskbar. Anyone knows the trick to fix this?

If there were a way to do what you want to do, every popup ad in the world would use it and the web would be a worse place. so there isn't a way to do it. =)
You might have better luck if the window.open occurs in a click handler or something like it - there are complicated heuristics baked into the browser around allowing poups if they're deemed 'intentional'.

I actually got this working. Initially I was opening IE8 using the IE icon on the task bar menu. For some reason I then decided to open IE directly from C:/Program Files/Internet Explorer/ and it worked as expected.

Related

Automatic Maximize a window if user minimizes

I have a popup that can't be minimized before completing the operation. if a user minimize it, it should automatically gain focus and stay maximized.
I was able to achive the same in IE but not in chorme.
Following code works in IE:
var popup = window.open("https://www.google.com", "popup_window", "fullscreen");
if (popup.outerWidth < screen.availWidth || popup.outerHeight < screen.availHeight)
{
popup.moveTo(0,0);
popup.resizeTo(screen.availWidth, screen.availHeight);
}
This opened the screen without minimize button which solved the problem.
Suggest an alternative for chrome
Focusing the window this way isn't cross browser compatible. I guess Firefox, Chrome and Safari won't obey. I mean imagine if ads over the internet could oblige the user to keep the focus on their page... I would be a complete mess. So i think it's a security.
Could you explain the need for the window to stay maximised? Focusing windows this way can be difficult, so perhaps the problem may best be solved by not requiring the window to stay maximised.

Javascript Popup Browser Tab Will Not Gain Focus

I'm using this bit of javascript in a .NET 4.0 web application for IE8:
ClientScript.RegisterStartupScript(this.Page.GetType(), "popupOpener", "var popup=window.open('Report.aspx');popup.focus();", true);
This opens an .aspx page in a new browser tab.
However, it does not give the tab focus, which I would very much like to do. Does anyone know how to achieve this?
Not all browsers support focus, and I believe there are some bugs even among those that do.
Try to blur the window before giving it focus. It's bizarre but has worked for folks in the past.
In general:
popup_handle.blur();
popup_handle.focus();
As applies to your code:
ClientScript.RegisterStartupScript(this.Page.GetType(), "popupOpener", "var popup=window.open('Report.aspx');popup.blur();popup.focus();", true);

WIndow.open in Javascript

I really need your help. I am working on a pop up window
using JavaScript.
I am using the window.open(URL,name, properties);
I wanted to load a window that does not load the URL window.
I tried the location=0 and location=no setting, it seems to work
fin on Firefox but alas it is not working on IE!
In Firefox, it is not showing the location bar anymore, but in IE
the location bar is still there with the URL!
Please help. :9
tinks~
You seem to be calling the method correctly, IE most likely doesnt allow you to hide its url bar. Most browsers have user-defined preferences whether they want to allow websites to be able to hide toolbars. Popups are very susceptible to security options.
I'm afraid you'd have to live with it, if the user doesnt want you to hide the url it wont.
Not possible anymore as all modern browsers do not allow you to hide the URL in Popups anymore :)

Window.open opening tab instead of popup in Opera?

I'm simply opening a popup from JavaScript with the settings you can see in the code. Works fine in Firefox. In Opera it's opening it in a new tab instead. Why?
Here's a JSFiddle:
http://jsfiddle.net/hafWs/3/
The number of parameters doesn't seem to make a difference. Either work in Firefox and IE8. (Don't have IE9 or Chrome to test right now.)
I tried googling... can't find anything. I don't even see anything here that mentions it, yet it's clearly working in their examples: http://www.quirksmode.org/js/popup.html
Thank you for any help.
There is problem with spaces in options param:
window.showPopup = function(){
window.open(
'http://placekitten.com/600/500',
'thePopup',
'width=600,height=500' /* <------- Look, no spaces and works */
);
}
It is still a tab, but with different dimensions. So, it looks kinda as popup.
This is controlled by the browser itself (preferences) and cannot be changed from JavaScript.
NOTE: I've seen some posts that say you can determine whether the window opens in a tab or as a new window based on the parameters that you pass the window.open function. I have never seen this work consistently.

IE click sound and jQuery

Using jQuery, is there a way to disable the click sound in IE that happens when you post?
The IE click sound is a feature of the browser that you can't control from JavaScript. The only way to disable it is in System Sounds in the Control Panel.
It may very well be possible using this solution: http://www.julienlecomte.net/blog/2007/11/30/
But in short, John is right about it being a browser sound not controlled by javascrípt or anyting else than a registry change, wich a website will not manage to do.
I know the above "trick" has worked before, so if nothing has changed it will still work.

Categories