X
點擊此處開啟此網站的行動版。

技術支援討論區

If there are two tabs and the second tab opens on clicking a button in first tab.The second tab if already open does't get focus.

已張貼

On clicking a button open a new tab and if the tab is already open then on clicking the button again the opened tab should get focus but it doesn't get focus.

On clicking a button open a new tab and if the tab is already open then on clicking the button again the opened tab should get focus but it doesn't get focus.
引用
jscher2000
  • Top 10 Contributor
8568 個解決方法 70075 個答案

Is the link/button a window.open() that (re)uses a named window, such as

window.open('app.html', 'appwindow');

On the first use, with the default settings, Firefox needs to DIVERT the new window to a new tab instead. By default, Firefox gives that new tab focus.

On the second load, Firefox does NOT need to open either a new window or a new tab, it only needs to launch a page in the existing tab. So I don't think these two preferences apply to that process:

(1) In a new tab, type or paste about:config in the address bar and press Enter/Return. Click the button promising to be careful or accepting the risk.

(2) In the search box above the list, type or paste inback and pause while the list is filtered

  • browser.tabs.loadInBackground has a default value of true
  • browser.tabs.loadDivertedInBackground has a default value of false

Changing that first one to false didn't affect this problem for me.

If you are the application developer and you want the page to get the focus, you could look at something like https://developer.mozilla.org/docs/Web/API/Window/focus to see whether that works for you.

See also: Where to go for developer support

Is the link/button a window.open() that (re)uses a named window, such as window.open('app.html', 'appwindow'); On the first use, with the default settings, Firefox needs to DIVERT the new window to a new tab instead. By default, Firefox gives that new tab focus. On the second load, Firefox does NOT need to open either a new window or a new tab, it only needs to launch a page in the existing tab. So I don't think these two preferences apply to that process: (1) In a new tab, type or paste '''about:config''' in the address bar and press Enter/Return. Click the button promising to be careful or accepting the risk. (2) In the search box above the list, type or paste '''inback''' and pause while the list is filtered * browser.tabs.loadInBackground has a default value of true * browser.tabs.load'''Diverted'''InBackground has a default value of false Changing that first one to false didn't affect this problem for me. If you are the application developer and you want the page to get the focus, you could look at something like https://developer.mozilla.org/docs/Web/API/Window/focus to see whether that works for you. See also: [[Where to go for developer support]]
這篇文章有幫助嗎?
引用

提出問題者

did the chnage you suggested but it didn't resolve my issue

did the chnage you suggested but it didn't resolve my issue
這篇文章有幫助嗎?
引用
jscher2000
  • Top 10 Contributor
8568 個解決方法 70075 個答案

Yes, I said I tested that change and it didn't have any effect. So then I wrote:

jscher2000 said

If you are the application developer and you want the page to get the focus, you could look at something like https://developer.mozilla.org/docs/Web/API/Window/focus to see whether that works for you. See also: Where to go for developer support

Are you the application developer, or do you need an end-user hack-around for that site?

Yes, I said I tested that change and it didn't have any effect. So then I wrote: ''jscher2000 [[#answer-1210225|said]]'' <blockquote> If you are the application developer and you want the page to get the focus, you could look at something like https://developer.mozilla.org/docs/Web/API/Window/focus to see whether that works for you. See also: [[Where to go for developer support]] </blockquote> Are you the application developer, or do you need an end-user hack-around for that site?
這篇文章有幫助嗎?
引用

提出問題者

I am an application developer .Is there any solution ?

I am an application developer .Is there any solution ?
這篇文章有幫助嗎?
引用
jscher2000
  • Top 10 Contributor
8568 個解決方法 70075 個答案

Please try the two links I provided before.

Please try the two links I provided before.
這篇文章有幫助嗎?
引用

提出問題者

It didn't resolve my issue.

It didn't resolve my issue.
這篇文章有幫助嗎?
引用
jscher2000
  • Top 10 Contributor
8568 個解決方法 70075 個答案

If you posted a question on Stack Overflow, could you provide a link to it here for reference. If you didn't post there yet, please see the link in this article: Where to go for developer support.

If you posted a question on Stack Overflow, could you provide a link to it here for reference. If you didn't post there yet, please see the link in this article: [[Where to go for developer support]].
這篇文章有幫助嗎?
引用
問個問題

如果您還沒有帳號,您必須先 登入您的帳號 來回覆文章。請 開始一個新問題