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. Javascript

Javascript

Scheduled Pinned Locked Moved ASP.NET
questionjavascriptcomtoolshelp
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.
  • S Offline
    S Offline
    Smith
    wrote on last edited by
    #1

    http://www.codeproject.com/script/Forums/View.aspx?fid=1640&msg=2941077[^] Sorry if I'm making a repost. but I've been waiting for 2 days, and I tried posting the same question few months ago. I'm not able to find an answer for it. I left my efforts to find the answer & I'm taking the issue again. It's a simple one. Can someone look into it please?

    :beer:

    A 1 Reply Last reply
    0
    • S Smith

      http://www.codeproject.com/script/Forums/View.aspx?fid=1640&msg=2941077[^] Sorry if I'm making a repost. but I've been waiting for 2 days, and I tried posting the same question few months ago. I'm not able to find an answer for it. I left my efforts to find the answer & I'm taking the issue again. It's a simple one. Can someone look into it please?

      :beer:

      A Offline
      A Offline
      Adam Maras
      wrote on last edited by
      #2

      The problem is that JavaScript doesn't know (nor does it care) what the root of your application is. Something you can do is, in your script code, add a server-side expression that represents your application root, and assign it to a variable. From there, you can concatenate your relative path values.

      var applicationRoot = "<%= System.Web.HttpContext.Current.Request.ApplicationPath %>";

      document.open(applicationRoot + "/myFolder/myDoc.htm");

      S 1 Reply Last reply
      0
      • A Adam Maras

        The problem is that JavaScript doesn't know (nor does it care) what the root of your application is. Something you can do is, in your script code, add a server-side expression that represents your application root, and assign it to a variable. From there, you can concatenate your relative path values.

        var applicationRoot = "<%= System.Web.HttpContext.Current.Request.ApplicationPath %>";

        document.open(applicationRoot + "/myFolder/myDoc.htm");

        S Offline
        S Offline
        Smith
        wrote on last edited by
        #3

        looks like a good idea. Thanks.

        :beer:

        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