how to open a file ??

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
rrn
Forum Commoner
Posts: 46
Joined: Wed Apr 15, 2009 7:54 am

how to open a file ??

Post by rrn »

hi

my website is in php .
am using a javascript code to open a file .

Code: Select all

function dec()
{
 
window.open("www.test.com/files/2010/test.pdf");
 
}
when i click the hyperlink connected to this function , a browser window is opened .path to the file will be dispaled in the address bar
i dont want it like tat.
i need to open only the file test.pdf , not in browser window so that path will not be seen .
pls help.
pbs
Forum Contributor
Posts: 230
Joined: Fri Nov 07, 2008 5:31 am
Location: Nashik, India
Contact:

Re: how to open a file ??

Post by pbs »

There are different options in window.open for statusbar, titlebar etc.

Refer: http://www.houseofscripts.com/scripts/j ... penwin.htm
rrn
Forum Commoner
Posts: 46
Joined: Wed Apr 15, 2009 7:54 am

Re: how to open a file ??

Post by rrn »

That didnt help :cry:

Code: Select all

<html>
<head>
<script type="text/javascript" language="JavaScript">
function OpenLink(theURL)
{
window.open(theURL);
}
</script>
</head>
 
<body>
<a href="javascript&#058;OpenLink('www.test.com/filename.pdf')">Test</font></a>
</body>
</html>
when i click "test" , a browser window is opened showing filename.pdf , path to the file is also shown in he address bar.
the file should not be opened in a browser window , it should open as a pdf file .
or
i should hide the path to the file in the browser window.
any help is appreciated .
thanks
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Post by Jonah Bron »

Did you look at the code in the page given? This is an excerpt:
window.open('../index.html', 'myWin', 'resizable=yes,toolbar=no,location=no,directories=no,
status=no,menubar=no,scrollbars=yes')
This shows the syntax for giving the window parameters.
Post Reply