Call a JavaScript function across browser tabs

前端 未结 4 2009
离开以前
离开以前 2020-12-10 17:37

I have two browser tabs, tab1 and tab2.

I have a function called execute in tab1, which I would like to call from the page in tab2.

Is that possible and if s

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-10 18:01

    You should show your html in the first place, but i assume your tab has a link, you could do like this:

    Tab 2
    

    JQuery:

    $('#tab2').click(function(){
       // your function code here
    
      // prevent default action
      return false;
    })
    

提交回复
热议问题