How to temporally hide the Navigation Bar from Firefox extension? - 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

Related

Switching tab on iOS mobile browser is not working via a href target or even window.open window focus

I've been working on this for 1 week, but no luck I can't find any answer on this.
I want to switch tab on my browser iOS mobile via javascript or html, I tested it in all browser in mac and android, it's working as expected. But in iOS mobile it's not working. I saw some articles that I need to disable popup blocker which I did.
I tried simple way like
go
this will just create new window but when I clicked it again it doesn't switch to this tab
const newWindow = window.open(href,"custom_name")
same thing happens in here.
I also tried
newWindow.focus()
nothing happens
I read there's an article that iOS blocked the popup new window for security policy, not sure if this switching of tab is also included in that policy.
Is there a way to do this?

Firefox addon: Window.open() vs CTRL-N

I created a simple firefox add on using addon-builder that installs & successfully appears in the add on toolbar at the bottom of the browser.
If I press ctrl-n, open new tab, open new window, or open private browsing window in firefox, then I see and can use my addon. However, if another site programmatically opens a window using window.open(), then my addon doesn't appear.
Is this by design? Or is there a setting that I can include in my addon so that it always appears, even if the window was opened through window.open() instead of ctrl-n?
When sites open with window.open, they specify which parts of the browser UI will show. You may be able to place it somewhere less likely to be removed, like the navigation toolbar. The add-ons toolbar sounds like it's going away soon, anyway.

Chrome bug workaround: Javascript to steal focus

When I start Chrome, the new window appears as unfocused & behind the other windows. So I decided to create a workaround; I'll change my homepage url with a file from my disk which one contains javascript to steal focus and then redirect to real homepage.
What is the best method to steal focus, using javascript?
UPDATE: Here is what I attempted...
<html>
<head></head>
<body></body>
</html>
<script type="text/javascript">
myWindow=window.open("http://google.com", "_blank",
"resizable=yes, scrollbars=yes, titlebar=yes" );
myWindow.focus();
self.close();
</script>
However new window looks like popup window, Chrome doesn't display toolbars & adress bar is not editable :(
More info about the bug:
http://productforums.google.com/forum/#!topic/chrome/zyLC4Ip96pU
As far as I'm aware, this has only started on the latest update. If Chrome is already open, when I open a new window of Chrome from a shortcut in the quick launch area of my Windows toolbar, the new window does not take focus, the focus remains on the previous Chrome window. If the focus was not on the previous Chrome window when I launch the shortcut it works fine
I just published a small Chrome Extension which aims at solving this bug! So far it worked great for me (on Window 7 64-bit).
You can find it here: https://chrome.google.com/webstore/detail/chrome-new-window-focus/opmhcfhkhiodgapmnaolhmekmfihmecp
Let me know if you encounter any issues!
Cheers,
Yuvi
http://www.w3schools.com/jsref/met_win_focus.asp

resizeTo() not working in Firefox

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

Windows.open in chrome

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.

Categories

Resources