I'm trying to use this in a website, it's for SEO needs ... It work well but this code :
window.open(url)
Don't produce the same result in all browser, in FF and IE, it create a new tab but in Chrome it open a new window and in Safari it didn't work at all.
Any idea to fixe it or another way to do this ?
This is a browser option. You can't really control that. Check the browser settings for tab operation.
Browser settings control how window.open works. It can pick to open in a tab or a new window and there is nothing in JavaScript that can override that.
If you set some options that don't 'fit' the main window, a new window will open instead of a new tab. Tried with the width setting and ff6 and ie7.
Related
My requirement is to open URL in new tab in IE browser using javascript. Could you please suggest me the best way.
I wrote following code , but it did not open redirectUrl in new tab in IE browser.
window.open(redirectUrl, '_newtab');
window.open() works different in each browser. in Chrome, it will open in a new tab, in IE (11) users need to define if it open in a new window or a new tab in settings, basically there is no way to use window.open to force IE to open in a certain way by javascript.
I'm developing an extension for Firefox for Android and I need to programatically open a new tab with no navigation bar. I know I can do it with JS with window.open("http://www.google.com", "mywindow", "location=0,toolbar=0"); but this time I need to disable it another way, because the tab is being opened via loadURI. So, the thing is, how can I change the toolbar visibility once loadURI was executed?
Thanks in advance!
You have to make browser go to full screen mode to achieve that.
For mobile FF you have to create manifest and at there:
"fullscreen": "true"
https://developer.mozilla.org/en-US/Apps/Build/Manifest#fullscreen
I tryed a lot of things I fount over Internet but no success because there is no XUL in FF for Android. So I just solved it by calling fullscreen mode:
window.BrowserApp.selectedBrowser.contentWindow.fullScreen = true;
Where window is the chrome window, not the object window
Running Firefox 12.0. I'm just starting to write a app that I want to run on localhost. I want it to open it in a (600,400) window, but since I have Firefox set to open everything in tabs I thought I could bookmark it and right-click to open it in a new window.
$(document).ready(function() {
window.resizeTo(600,400);
});
Doesn't work. Is what I am trying to do possible?
Thanks, Jim
This isn't possible, unless the window was opened through javascript using window.open and has only 1 tab in it.
Since Firefox 7, it's no longer possible for a web site to change the default size of a window in a browser, according to the following rules:
- You can't resize a window or tab that wasn’t created by window.open.
- You can't resize a window or tab when it’s in a window with more than one tab.
MDN docs
Hey guys. There are a few entries here requiring solutions to do the opposite of this, and others vaguely related. In one of them, the poster asked how to do this on Mozilla Firefox. Actually though, firefox will always open the URL in a new tab when window.open() is called, unless you set the window's size within its parameters.
So Mozilla and Chrome do what I want by default. The question is: how do I get Internet Explorer to open the URL I want within a new tab, as opposed to doing it in a new window?
Thanks in advance.
The obvious answer is to open the link with target="_blank". As you said, Firefox and Chrome will open a new tab.
Regarding IE - the behavior is up to browser preferences. By default (in IE7+ obviously) I believe the behavior is defined as open new tab. If the user decided the behavior should be a new window, there's only so much you can do about it.
i'm trying to open popup window this this jscript:
window.open(myUrl, "");
for some users the page appears in a new tab, but I want it in a popup window.
maybe someone know any reason for it?
For the most part, this is a configuration setting in most modern browsers that the user controls. However, if you specify window dimensions and/or features on the window.open call, some browsers may open a new window when they otherwise would have opened a new tab. For example:
window.open("mypage", "_blank", "width=400,height=200,menubar=no,toolbar=no");
At the end of the day, though, it's stil down to the browser implementation, and as ever, you'll need to test to ensure you're getting the results you hope for across the majority of browsers your app/site supports/typically sees.
This article might be of help: http://www.blazonry.com/javascript/windows.php.
You need to specify size attributes.
window.open(myUrl, "_blank", "width=640,height=480,menubar=no,toolbar=no");