1

I'm developing web pages using only under google chrome browser.

For example, my page is opened in a tab called MyTab.

And some times, the user is viewing a page in an other tab OtherTab.

Now, I want to trigger an activation on MyTab.

Then I tried:

<script>
// MyTab
setTimeout(function() {
    alert('activated');
}, 5000);
</script>

This do works, the MyTab page pops to the front.


Problem:

But I don't want to produce an alert();

Then I tried to call window.focus():

<script>
// MyTab
setTimeout(function() {
    window.focus();
}, 5000);
</script>

But with no luck. It seems the window.focus() method do not work.

Then I tried to find the problem: window.focus() not working in Google Chrome

But it don't quite points out to a solution for me.


So, is there any way to pop the window tab to the front, with out using alert()?

Community
  • 1
  • 1
Alfred Huang
  • 17,654
  • 32
  • 118
  • 189
  • 3
    see this https://stackoverflow.com/questions/2704206/how-to-change-browser-focus-from-one-tab-to-another – Kedar Mar 06 '15 at 08:56

1 Answers1

0

as far as I know opening new tab is only way to achieve that.

$.get(location.href, function(){window.open(location.href)}, 'html');
setTimeout(function(){
  window.opener = window;
  window.close();
},1000);

open new tab of same adrress. and close the old one.

suish
  • 3,253
  • 1
  • 15
  • 34
  • Does it mean the old page must be reloaded? – Alfred Huang Mar 06 '15 at 09:47
  • I mean duplicating(opening a new tab which has same location) the page is only way to force activate a tab in chrome.and yes it's almost same meaning it has to be reloaded(fresh loaded). – suish Mar 06 '15 at 09:55