最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Open Chrome or Firefox without tabs and other menu items and with a set screen position and size - Stack Overflow

programmeradmin3浏览0评论

I need to startup either Chrome or Firefox in a set location, with a set size and without the tabs and other menu items. The ultimate goal is a desktop icon I can click to get a window X wide by Y tall at x,y on my desktop showing a particular page, without making these settings permanent for the browser.

This is going to be a small window placed in the corner of a desktop showing an AJAX page that is updating throughout the day.

I can't seem to find any option for either of these browsers.

I need to startup either Chrome or Firefox in a set location, with a set size and without the tabs and other menu items. The ultimate goal is a desktop icon I can click to get a window X wide by Y tall at x,y on my desktop showing a particular page, without making these settings permanent for the browser.

This is going to be a small window placed in the corner of a desktop showing an AJAX page that is updating throughout the day.

I can't seem to find any option for either of these browsers.

Share Improve this question edited Dec 9, 2019 at 18:54 Makyen 33.4k12 gold badges92 silver badges125 bronze badges asked Oct 1, 2014 at 17:36 vStevevSteve 951 gold badge2 silver badges9 bronze badges 2
  • 1 Possible duplicate of How to hide address bar from chrome and mozilla – Evan Carroll Commented Nov 24, 2018 at 22:53
  • The below mentioned add-ons don't work anymore with newer FF versions. I added an alternative answer to the above mentioned duplicate. – Ida Commented Nov 11, 2021 at 14:59
Add a ment  | 

1 Answer 1

Reset to default 5

In Firefox:

You can find details of the Firefox "Command Line Options" on MDN.

It appears you can not do exactly what you desire, if you want to continue to have the page opened under your normal profile and without having your normal use of that profile disturbed. If you are willing to use a separate profile which is used only for this task, then you can acplish what you desire. Using another profile is not a big deal. I monly have more than one running at a time, and even use different versions of Firefox running at the same time under different profiles.

Using a separate profile and add-ons:

To create a new profile see: Use the Profile Manager to create and remove Firefox profiles or Multiple Firefox profiles. Create a profile, choose a name.

You will need some add-ons:

  • Hide Navigation Bar (change options (Tools->Add-ons then "Extensions" and the "options button for this extension. Select "When Firefox starts: Hide the Navigation Bar")
  • Hide Tabbar (change options to select "Auto hide when only one tab is open")

There may be others you could use, but the bination of these two worked when I tested it.

Go to the page you want to see. Adjust the size and position of the window to what you desire. By right clicking the mouse in the toolbar area de-select "Menu Bar" and "Bookmarks Toolbar". Close Firefox. Firefox should automatically remember the size and location of the window.

Create a shortcut:

  "C:\Program Files\Mozilla Firefox\firefox.exe" -no-remote -P "My Profile Name" -url "http://the page I want to see"

Click on the shortcut. That should work.

Shameless plug: If you want the icon for the window to be different so you can tell the windows apart in the taskbar, you could use: Change Profile's Window Icons. An extension whicht arose from my answer to a stackoverflow question. If you do change the icon, you will probably want to change the properties for the shortcut to point to the icon you use.

Getting close to what you want using your current profile without disturbing it:

Without using an add-on you can e close. [Note: all were tested in Firefox and a Windows operating system assumed (for file paths).]

You could use a bookmarklet to open a static URL in a limited window :

javascript:void(window.open("http://www.google.","_blank","outerWidth=400,outerHeight=200,top=500,left=600,menubar=no,toolbar=no,location=no,personalbar=no,status=no,resizable"))

or the URL you are currently viewing:

javascript:void(window.open(location.href,"_blank","outerWidth=400,outerHeight=200,top=500,left=600,menubar=no,toolbar=no,location=no,personalbar=no,status=no,resizable"))

You can have the window open from a desktop shortcut, but in order to have the window with a limited interface you will end up with a normal size window which you will have to close (scripts are not permitted to close windows which are not opened by a script). You would need to use an html file on your machine to contain the script to open the appropriate URL.

Note the first time you do this Firefox will inform you that it blocked a popup. You will need to permit popups from that file URL.

Example HTML file (example assumes it is located at: C:\open_location.html):

<head>
    <script class="code" type="text/javascript">
        var features =  ""  
                        + "menubar=no,toolbar=no,location=no,personalbar=no"
                        + ",status=no,chrome=yes,resizable,centerscreen"
                        //+ ",width=400"        //Width of content window
                        //+ ",height=200"       //Height of content window
                        + ",outerWidth=400"   //Width of window
                        + ",outerHeight=200"  //Height of window
                        + ",top=500"
                        + ",left=600"
                        ;
        window.open("http://www.google./","_blank",features);
        //Can only close windows opened by script.
        //window.close();
    </script>
</head>
<body>
</body>

You could then use a shortcut that opens the URL of that file:

"C:\Program Files\Mozilla Firefox\firefox.exe" -url "file://C:/open_location.html"

I would suggest using a separate profile:

"C:\Program Files\Mozilla Firefox\firefox.exe" -no-remote -P "My Profile Name" -url "file://C:/open_location.html"

You can get rid of the URL bar from all of the above by setting dom.disable_window_open_feature.location=false in about:config. However, if you do that I remend using a different profile which is used for this purpose only as you normally don't want to do such for normal use.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论