Problem in Window.open(url, name, features)

950 views
Skip to first unread message

Raul

unread,
Jul 9, 2009, 3:34:04 AM7/9/09
to Google Web Toolkit
Hello all,

I have a problem with the Window function

Window.open(url, name, features)

I have few PDF files in my hard drive say in (C:/Information),
My Server path is C:/Tomcat_Home;
I have a PDF file named C:/Information/contacts.pdf

When I tried to open this PDF in a new Browser window using the
function
Window.open("C:/Information/contacts.pdf", "_blank", "");
the hosted browser with eclipse works fine.

But when I tried the same thing with either Mozilla or IE8, I did not
get any response from the browser. There is no error message in
Developer Tools(IE) and Firebug too.

I am unable to find out the exact cause for this.

My Pop up blocker is also turned off...

Hosted Browser working fine but the Standard browser are not....

Strange..!!

plz put some help...!!



regards
raul

alex.d

unread,
Jul 9, 2009, 8:08:46 AM7/9/09
to Google Web Toolkit
Nothing strange at all - you can't just read local files from your
browser. Put your file in the server's public folder (where your html
and other files are) and get it with http://localhost:xxxx/bla/bla/file.pdf
(or smth. similar ;)

Rafael

unread,
Jul 9, 2009, 9:23:31 AM7/9/09
to Google Web Toolkit
hey alex.d,

I have a similar problem with serving a csv file to IE 8. As in, i do
window.open("http://host/blah/file.csv", "_blank","") and it does not
open a new window to the file specified. It does work in FF and
Chrome.

If i grab the url and manually enter it in address bar of a new window
it gives me a 'save as...' dialog window (which is fine).

Any ideas???

On Jul 9, 8:08 am, "alex.d" <alex.dukhov...@googlemail.com> wrote:
> Nothing strange at all - you can't just read local files from your
> browser. Put your file in the server's public folder (where your html
> and other files are) and get it withhttp://localhost:xxxx/bla/bla/file.pdf

David Parry

unread,
Jul 9, 2009, 11:00:54 AM7/9/09
to Google Web Toolkit
Try setting the ContentType in the response to "application/pdf"

David


On Jul 9, 8:08 am, "alex.d" <alex.dukhov...@googlemail.com> wrote:
> Nothing strange at all - you can't just read local files from your
> browser. Put your file in the server's public folder (where your html
> and other files are) and get it withhttp://localhost:xxxx/bla/bla/file.pdf

kelvin.huang

unread,
Jul 9, 2009, 4:33:42 PM7/9/09
to Google Web Toolkit
Hi Raul,

Try this link, it should solve your problem.

http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/b4adf81640edc0d9

Window.open(GWT.getModuleBaseURL() + "ServletName?filename=" +
filename, "_self", "");

Regards
Kelvin

alex.d

unread,
Jul 10, 2009, 2:21:13 AM7/10/09
to Google Web Toolkit
Yeh, i've experienced this issue - the problem lies in the IE8
security settings. If you'd change security settings to trusted zone
it works. But of course i can't change settings in all client
browsers. So i've ended up with opening a small html file with
Window.open() and this html-file redirects then to the csv-file.
Clumsy but it works. Let me know if you find a better solution.

Raul

unread,
Jul 10, 2009, 9:13:00 AM7/10/09
to Google Web Toolkit
Hello all,

Thanks a lot for your valuable replies.

But I am not yet come to a solution.

When I put the absolute hard drive path, eclipse hosted browser reads
the file well.
But when I try to use some path in the server I am not getting a way
to find the Server root path from the RemoteServiceServlet. Also I am
deploying my application in a war file, So I have to choose a
different directory from my application directory.
And GWT should permit to read a file locate outside the application
directory.

At client side files I can use GWT.getModuleBaseURL(), but what I will
have to use in the Server files to get the root URL?






On Jul 10, 1:33 am, "kelvin.huang" <keyang_hu...@yahoo.ca> wrote:
> Hi Raul,
>
> Try this link, it should solve your problem.
>
> http://groups.google.com/group/Google-Web-Toolkit/browse_thread/threa...
Reply all
Reply to author
Forward
0 new messages