Call a JavaScript function across browser tabs

前端 未结 4 2015
离开以前
离开以前 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条回答
  •  猫巷女王i
    2020-12-10 18:05

    I really cannot understand what you mean by the question.

    But you can pass javascript function references as arguments to other functions.(Be wary of object execution contexts).

    So while initializing "tab2", you could send in the function reference of execute of "tab1", to "tab2".

    Could have given a more definitive answer with an example , had you been clearer in your question.

提交回复
热议问题