I have an ASP.NET button in my application, which I want to open another website on my server in a new window. Currently I do a Response.Redirect in my server side on click event (to “..\OtherWebsite”) which works. But as it needs to be in a new window I need to do it in JavaScript.
Would ‘..\OtherWebsite’ path work in the window.open JavaScript command? If not, what .NET methods/properties can I use to get the full path?
I can’t hard code the website URL as some users will be accessing through a LAN (server name\application) and some through the website (www.website.com/application)
You can use
self.location.hrefto get the currect url of the page, next form your new url relative to that and then pass it towindow.open()method.Here is the definition of window.open method.
Hope this helps…