Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. Accessing another windows variables

Accessing another windows variables

Scheduled Pinned Locked Moved JavaScript
question
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 4300686
    wrote on last edited by
    #1

    I have define a variable in window A. I set it to parent.variable=xxxx Now I open a new tab (window B). Can I access or take the parent.variable from window A in window B ?

    B A 2 Replies Last reply
    0
    • U User 4300686

      I have define a variable in window A. I set it to parent.variable=xxxx Now I open a new tab (window B). Can I access or take the parent.variable from window A in window B ?

      B Offline
      B Offline
      BobJanova
      wrote on last edited by
      #2

      Only if window B can refer to something in A's tree. I think when A spawns B it gets a reference to the new window, so A can add a reference to its own window into B's (i.e. new_window.referenceToA = window), and then code in B can use window.referenceToA.xxx.

      1 Reply Last reply
      0
      • U User 4300686

        I have define a variable in window A. I set it to parent.variable=xxxx Now I open a new tab (window B). Can I access or take the parent.variable from window A in window B ?

        A Offline
        A Offline
        all_in_flames
        wrote on last edited by
        #3

        If you opened the new window from the original window, you should be able to access the

        window.opener

        property in the DOM of the new window. This property gives you access to the DOM of the original window. Here is a link to the MDN entry for this property click[^] Cheers!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups