Solved

Trying to open window with relative url using Javascript

Posted on 2007-04-10
1
285 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
ID: 18885801
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…

948 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

22 Experts available now in Live!

Get 1:1 Help Now