By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,930 Members | 1,492 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,930 IT Pros & Developers. It's quick & easy.

Opening 2nd browser window and saving as .txt

P: n/a
I am attempting to write a javascript app that will open a second browser
window, load a url, such as www.google.com (foreign url) and perform a
<File-Save As> function on that window. I am able to do this with opening a
second window that loads a local file, but I get an Access Denied error when
I attempt this with a different website. Is there not a command in
javascript that will allow me to open a webpage and perform this function?

Thank you very much.
Jul 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Clinton Goff" <cg***@goffsolutions.com> wrote in
news:xj********************@rwcrnsc51.ops.asp.att. net:
I am attempting to write a javascript app that will open a second
browser window, load a url, such as www.google.com (foreign url) and
perform a <File-Save As> function on that window. I am able to do
this with opening a second window that loads a local file, but I get
an Access Denied error when I attempt this with a different website.
Is there not a command in javascript that will allow me to open a
webpage and perform this function?

Thank you very much.


my first inclination is that you will have to do this server side (ie suck
the web page in on the server) and provide header similiar to following:

Content-Disposition: attachment; filename="index.html"

which will tell the browser to supply a Save As dialog for the user.
Hope I am understanding your problem correctly.
Jul 20 '05 #2

P: n/a
If you're working in IE, I suggest looking up XMLHTTP where you can
load data from any url without worrying about rights issues. It
sounds like in your situation you don't have leeway in your browser to
access another domain's information. If you want a quick solution,
look up HTML Applications or "HTA". They are completely trusted (and
thus most people probably wouldn't want to run such a thing), but if
you just want to open a url in an IE window and grab the text, that
should do it.

"Clinton Goff" <cg***@goffsolutions.com> wrote in message news:<xj********************@rwcrnsc51.ops.asp.att .net>...
I am attempting to write a javascript app that will open a second browser
window, load a url, such as www.google.com (foreign url) and perform a
<File-Save As> function on that window. I am able to do this with opening a
second window that loads a local file, but I get an Access Denied error when
I attempt this with a different website. Is there not a command in
javascript that will allow me to open a webpage and perform this function?

Thank you very much.

Jul 20 '05 #3

P: n/a
The XML HTTP Request object does actually prevent retrieving data from sites other then the one it was downloaded from
in the default security environment.

As indicated you could use an HTA if this functionality is for you personally. If you are writing something for other
people to use, there isn't any way to achieve what you want without the user granting you additional permissions within
their browser.

asdf asdf wrote:
If you're working in IE, I suggest looking up XMLHTTP where you can
load data from any url without worrying about rights issues. It
sounds like in your situation you don't have leeway in your browser to
access another domain's information. If you want a quick solution,
look up HTML Applications or "HTA". They are completely trusted (and
thus most people probably wouldn't want to run such a thing), but if
you just want to open a url in an IE window and grab the text, that
should do it.

"Clinton Goff" <cg***@goffsolutions.com> wrote in message news:<xj********************@rwcrnsc51.ops.asp.att .net>...
I am attempting to write a javascript app that will open a second browser
window, load a url, such as www.google.com (foreign url) and perform a
<File-Save As> function on that window. I am able to do this with opening a
second window that loads a local file, but I get an Access Denied error when
I attempt this with a different website. Is there not a command in
javascript that will allow me to open a webpage and perform this function?

Thank you very much.


--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
* http://devedge.netscape.com/library/...ce/frames.html
* Internet Explorer DOM Reference available at:
* http://msdn.microsoft.com/workshop/a...ence_entry.asp
* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.