Solved

Trying to open window with relative url using Javascript

Posted on 2007-04-10
1
288 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Browser Chrome downloads colored link 5 40
simple javascript form validation 2 18
VB.NET 2008 Publish Error 2 25
How to show span when clicked on? 10 19
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
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…

785 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