How to call a function of another window in javascript?

omega

I open a new tab using window.open. The new tab has a javascript myfunction function in it defined in a script tag. From the window that opens the new window, I want to run that function.

How can I do that?

Thanks

Something like

var a = window.open("mypage.html", "_blank");
a.myfunction("hi");

EDIT

This isn't working. Its not doing the alert.

opener

        var w = window.open("../scripts/map.php", "_blank");
        w.postMessage("The user is 'bob' and the password is 'secret'", "*");

new tab

        function receiveMessage(event) {
            alert(event.data);
        }
        window.addEventListener("message", receiveMessage, false);
HDT
var a = window.open("mypage.html", "_blank");
a.focus();

a.addEventListener('load', function(){
  a.myfunction("hi");
}, true);

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to call a function within another function in javascript

From Dev

How to call a function within another function in javascript

From Dev

How to call a function that is inside another function javascript

From Dev

How to call parent window function on close of child window in javascript?

From Dev

How to test the function call count of another function in Javascript?

From Dev

How to test the function call count of another function in Javascript?

From Dev

How to call window.atob() javascript function from java code?

From Dev

How to Call Parent Window JavaScript Function inside iframe

From Dev

how to call user-defined function of a window object in javascript

From Dev

How to add a button inside a new window object and call the function in JavaScript?

From Dev

WPF Call a function when another window calls it

From Dev

Another way to call function javascript

From Dev

How to call the callback function with class name defined in another javascript file

From Dev

Javascript function call with another function as parameter

From Dev

Cannot call a function inside another function javascript

From Dev

Javascript modal window call function - bootstrap UI

From Dev

How to call function in another class

From Dev

How to call a function in another in angularjs

From Dev

How to call a function in another function in protractor

From Dev

How to call setinterval function in another function is not working

From Dev

how to call a function from another function in Jquery

From Dev

How to call a number from another function into a function?

From Dev

How call a function inside another function

From Dev

How to call a function that is inside another function?

From Dev

How to call from function to another function

From Dev

How to call a function from within another function?

From Dev

How to call the aggregate function in another function?

From Dev

How to call a reduce function in another function

From Dev

How to call a function with window.resize()

Related Related

  1. 1

    How to call a function within another function in javascript

  2. 2

    How to call a function within another function in javascript

  3. 3

    How to call a function that is inside another function javascript

  4. 4

    How to call parent window function on close of child window in javascript?

  5. 5

    How to test the function call count of another function in Javascript?

  6. 6

    How to test the function call count of another function in Javascript?

  7. 7

    How to call window.atob() javascript function from java code?

  8. 8

    How to Call Parent Window JavaScript Function inside iframe

  9. 9

    how to call user-defined function of a window object in javascript

  10. 10

    How to add a button inside a new window object and call the function in JavaScript?

  11. 11

    WPF Call a function when another window calls it

  12. 12

    Another way to call function javascript

  13. 13

    How to call the callback function with class name defined in another javascript file

  14. 14

    Javascript function call with another function as parameter

  15. 15

    Cannot call a function inside another function javascript

  16. 16

    Javascript modal window call function - bootstrap UI

  17. 17

    How to call function in another class

  18. 18

    How to call a function in another in angularjs

  19. 19

    How to call a function in another function in protractor

  20. 20

    How to call setinterval function in another function is not working

  21. 21

    how to call a function from another function in Jquery

  22. 22

    How to call a number from another function into a function?

  23. 23

    How call a function inside another function

  24. 24

    How to call a function that is inside another function?

  25. 25

    How to call from function to another function

  26. 26

    How to call a function from within another function?

  27. 27

    How to call the aggregate function in another function?

  28. 28

    How to call a reduce function in another function

  29. 29

    How to call a function with window.resize()

HotTag

Archive