Opening 2nd browser window and saving as .txt

C

Clinton Goff

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.
 
S

Sean Jorden

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.
 
A

asdf asdf

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.
 
G

Grant Wagner

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 said:
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.

--
| Grant Wagner <[email protected]>

* Client-side Javascript and Netscape 4 DOM Reference available at:
* http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html
* Internet Explorer DOM Reference available at:
* http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_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-developer/upgrade_2.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top