469,631 Members | 982 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,631 developers. It's quick & easy.

how to set relative url for window.open and hyperlink

Hi !

I have a problem with defining a relative url, which is one of
parameters of window.open call.
Here is the situation:

1. "Parent" page called 2000 is in subfolder of my app, the subfolder
is called Z.
2. On the 2000 page there is an asp hyperlink, which should open new
window with 2010 page. But since the window can't have browser menu
etc. I set onclick attribute with window.open command instead of
NavigateUrl property.
3. The 2010 page is also located in Z subfolder.
4. As an url of hyperlink I set /Z/2010.aspx
I tried also ~/Z/2010/aspx but it never worked.
5. Everything works fine when my app is run against Visual Studio
build in server. I mean the 2010 page opens in new browser window when
hyperlink is clicked, opens under url
http://localhost:2554/Z/2010.aspx page

6. The above doesn't work when app is deployed on IIS. Browser
attempts to open
http://localhost/Z/2010.aspx page
while it should be
http://localhost/MyApp/Z/2010.aspx.

What is wrong ?
Jun 27 '08 #1
1 6424
I found solution for that: the url which is passed to window.open must
be full url.
To get "prefix" I call
this.ResolveClientUrl("~/Z/2010.aspx")
and tylda character (~) is replaced automatically as needed.
Jun 27 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

40 posts views Thread by Brian Jorgenson | last post: by
4 posts views Thread by Olav Tollefsen | last post: by
4 posts views Thread by KenG | last post: by
6 posts views Thread by G Dean Blake | last post: by
9 posts views Thread by dana lees | last post: by
9 posts views Thread by smokeyd | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.