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. ASP.NET
  4. Redirect to another page ClientSide

Redirect to another page ClientSide

Scheduled Pinned Locked Moved ASP.NET
javascripthelp
3 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.
  • M Offline
    M Offline
    M_Menon
    wrote on last edited by
    #1

    Hi Friends I am trying to go from one page to another page using Javascript in my aspx page. I am using { window.location.href = link; } My var link has the URL and i did confirm it by using alert. I am getting the correct URL but i want it to go to that page. I think window.location.href is the method for redirecting to another page. Not sure whats wrong. If any of you have any suggestions or help, it would be appreciated. Thanks

    Cheers Menon

    F 1 Reply Last reply
    0
    • M M_Menon

      Hi Friends I am trying to go from one page to another page using Javascript in my aspx page. I am using { window.location.href = link; } My var link has the URL and i did confirm it by using alert. I am getting the correct URL but i want it to go to that page. I think window.location.href is the method for redirecting to another page. Not sure whats wrong. If any of you have any suggestions or help, it would be appreciated. Thanks

      Cheers Menon

      F Offline
      F Offline
      Fred_Smith
      wrote on last edited by
      #2

      What you have will work in IE, but not Firefox. Someone will no doubt say this is because FF is w3-compliant and IE isn't or some such nonsense, but don't believe them: it's a bug. The fix is twofold: First, add a "return false;" to stop FF posting the page back to itself: window.location.href=link; return false; Second, note that if running this script locally you will need to make your link absolute (http://...) but when running on a live web server a relative link will work. cheers Fred

      M 1 Reply Last reply
      0
      • F Fred_Smith

        What you have will work in IE, but not Firefox. Someone will no doubt say this is because FF is w3-compliant and IE isn't or some such nonsense, but don't believe them: it's a bug. The fix is twofold: First, add a "return false;" to stop FF posting the page back to itself: window.location.href=link; return false; Second, note that if running this script locally you will need to make your link absolute (http://...) but when running on a live web server a relative link will work. cheers Fred

        M Offline
        M Offline
        M_Menon
        wrote on last edited by
        #3

        Thanks Fred, Well you are correct it was bug from the browser, It doesnt work for FireFox and older versions of IE also, but works for IE7. Thanks again

        Cheers Menon

        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