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

"Get source" function

P: n/a
Is there a function that returns the html source of a given page as a
string?

Preferably, I'm looking for a function that takes a URL as an argument.
Alternatively, is there such a function that takes a handle to a
window (in which the desired page is open) as an argument?

Thank you,
David

Jul 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
David Cohen wrote on 11 jul 2003 in comp.lang.javascript:
Is there a function that returns the html source of a given page as a
string?

Preferably, I'm looking for a function that takes a URL as an argument.


function getUrl(url) {
var http = new ActiveXObject("microsoft.xmlhttp");
http.open("GET",url,false);
http.send();
return http.responseText;
}
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #2

P: n/a
When I try this, I get a "permission denied" error on the http.open()
for every URL that I try.

--David

Evertjan. wrote:
function getUrl(url) {
var http = new ActiveXObject("microsoft.xmlhttp");
http.open("GET",url,false);
http.send();
return http.responseText;
}


Jul 20 '05 #3

P: n/a
David Cohen wrote:
When I try this, I get a "permission denied" error on the http.open()
for every URL that I try.

--David

Evertjan. wrote:
function getUrl(url) {
var http = new ActiveXObject("microsoft.xmlhttp");
http.open("GET",url,false);
http.send();
return http.responseText;
}


You won't be able to get the source of a page other then one in the same
domain that your script was downloaded from in the default security
environment.

--
| 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 6/7 and 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.