Trang web này sẽ có chức năng hạn chế trong khi chúng tôi trải qua bảo trì để cải thiện trải nghiệm của bạn. Nếu một bài viết không giải quyết được vấn đề của bạn và bạn muốn đặt câu hỏi, chúng tôi có cộng đồng hỗ trợ của chúng tôi đang chờ để giúp bạn tại @FirefoxSupport trên Twitter và /r/firefox trên Reddit.

Tìm kiếm hỗ trợ

Tránh các lừa đảo về hỗ trợ. Chúng tôi sẽ không bao giờ yêu cầu bạn gọi hoặc nhắn tin đến số điện thoại hoặc chia sẻ thông tin cá nhân. Vui lòng báo cáo hoạt động đáng ngờ bằng cách sử dụng tùy chọn "Báo cáo lạm dụng".

Tìm hiểu thêm

Is there a way other than window.open to control the position of a new window?

  • 5 trả lời
  • 1 gặp vấn đề này
  • 1 lượt xem
  • Trả lời mới nhất được viết bởi cor-el

more options

I start a new browser programmactically by issuing a "firefox -new-window -url ....."

The first time, with no browser running, when I do this the new window appears in the location where I last positioned a browser window. Note that all use of the browsers is in non-fullscreen.

If I issue the command again (to open a second window), the window appears in a completely different position and in all subsequent browser start commands the window appears in this new position.

Is there a way of forcing all new windows to appear in the same location when they start? (command-line parms, preferences, ?).

I have done the repositioning using windows functions (SetWindowPos, etc) but that "flashes" window as it initially appears and then reappears after re-positioning.

My application doesn't allow me to use tabs so I require individual browser windows.

Regards, Jim

I start a new browser programmactically by issuing a "firefox -new-window -url ....." The first time, with no browser running, when I do this the new window appears in the location where I last positioned a browser window. Note that all use of the browsers is in non-fullscreen. If I issue the command again (to open a second window), the window appears in a completely different position and in all subsequent browser start commands the window appears in this new position. Is there a way of forcing all new windows to appear in the same location when they start? (command-line parms, preferences, ?). I have done the repositioning using windows functions (SetWindowPos, etc) but that "flashes" window as it initially appears and then reappears after re-positioning. My application doesn't allow me to use tabs so I require individual browser windows. Regards, Jim

Tất cả các câu trả lời (5)

more options

You can try JavaScript:

firefox.exe -new-window "javascript:window.moveTo(0,0);window.resizeTo(800,450);location.href='http://www.google.com';"

Được chỉnh sửa bởi cor-el vào

more options

I tried your suggestion and it worked great for URLs in the form "www.google.com".

However when I start firefox with firefox.exe -new-window "javascript:window.moveTo(100,100);window.resizeTo(1000,800) ;location.href='file:///c:/Program files (x86)/RideRunner/Plugins/MultiBrowser/HTML/simple_maps.html';"

Firefox starts and is resized and positioned correctly but the file:// url is not processed.

The HTML file exists and the file:// url works if entered directly into the browser. However, the command doesn't work if entered at the command line prompt.

When I try the above, I get the following:

Security Error: Content at about:blank may not load or link to file:///c:/Program%20files%20(x86)/RideRunner/Plugins/MultiBrowser/HTML/simple_maps.html.

I have no idea what to look at or where to look.

Any and all help appreciated.

Regards, Jim

more options

I have been doing some further experimentation and have discovered a more basic error.

If I use "window.location='file://...',

I get the error "Access to 'file://...' from script denied".

It would appear that there is some security/privilege setting that is wrong.

I did some web searching and only came up with a generic description of the issue and what to do but it was quite old.

I am running this on both Vista and XP SP3.

Any help appreciated.

Regards, Jim

more options

http://kb.mozillazine.org/Links_to_local_pages_do_not_work#Path_Syntax

I don't know about command line arguments, but try
file://///c:/Program%20files%20(x86)/RideRunner/Plugins/MultiBrowser/HTML/simple_maps.html
with 5 forward slashes.

more options

I think that the only way to make that work is accessing the pages via http://localhost and not use the file:// protocol.