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. top.location.href from an Iframe

top.location.href from an Iframe

Scheduled Pinned Locked Moved Web Development
helpquestion
4 Posts 2 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.
  • X Offline
    X Offline
    xaphod
    wrote on last edited by
    #1

    Hi, I'm pretty desperate. I have a page (default.aspx) with an iframe. In the iframe i have two frames. In one of the frames I have a LinkButton that should redirect the top page (default.aspx) I've tried RegisterStartupScript with lots of different Javascripts like: top.location.href='new.aspx' but all is loaded in the iframe... Is this doable? Please, please help!

    G 1 Reply Last reply
    0
    • X xaphod

      Hi, I'm pretty desperate. I have a page (default.aspx) with an iframe. In the iframe i have two frames. In one of the frames I have a LinkButton that should redirect the top page (default.aspx) I've tried RegisterStartupScript with lots of different Javascripts like: top.location.href='new.aspx' but all is loaded in the iframe... Is this doable? Please, please help!

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      I actuaklly never tried using a frameset in an iframe, but this is how I think that it works: Using the window.top property inside a frame will reference the frameset, e.g. the contents of the iframe. From there you can use the window.parent property to reference the page containing the iframe. So, this should work: window.top.parent.location = 'new.aspx'; --- b { font-weight: normal; }

      X 1 Reply Last reply
      0
      • G Guffa

        I actuaklly never tried using a frameset in an iframe, but this is how I think that it works: Using the window.top property inside a frame will reference the frameset, e.g. the contents of the iframe. From there you can use the window.parent property to reference the page containing the iframe. So, this should work: window.top.parent.location = 'new.aspx'; --- b { font-weight: normal; }

        X Offline
        X Offline
        xaphod
        wrote on last edited by
        #3

        Actually I got to apologize. I guess I got a little too tired, and didnt get the code in the right eventhandler at first. So top.location.href do work! Thanks anyway Guffa - I'll try your idea also.

        G 1 Reply Last reply
        0
        • X xaphod

          Actually I got to apologize. I guess I got a little too tired, and didnt get the code in the right eventhandler at first. So top.location.href do work! Thanks anyway Guffa - I'll try your idea also.

          G Offline
          G Offline
          Guffa
          wrote on last edited by
          #4

          In that case just use window.top.location. --- b { font-weight: normal; }

          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