Solved

Trying to open window with relative url using Javascript

Posted on 2007-04-10
1
284 Views
Last Modified: 2013-12-17
Im wanting to use javascript to open a new window. The pdf file to be opened in the new window is in the directory "Doc" relative to the current directory. Should the following code work or am I doing something wrong?

window.open('Docs\\charing.pdf')

0
Comment
Question by:rangers99
1 Comment
 
LVL 15

Accepted Solution

by:
stanscott2 earned 50 total points
Comment Utility
Try this, instead:

window.open('/Docs/charing.pdf');

You may not need the first slash before the Docs item, but definitely use a single forward slash between Docs and charing.pdf
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now