从网站捕获和使用html [英] capturing and using html from website

查看:84
本文介绍了从网站捕获和使用html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。我在这个舞台上有点新手所以请原谅,如果这个

问题反映了这一点。我正试图从网站上获取html并且

在另一个网页中显示它(一旦我开始工作,我将要用

以其他方式操纵html - 这不是这个

努力的最终目的。为此,我尝试从URL打开另一个包含

源html的窗口,然后从该窗口捕获html。我好b $ b可以打开窗户,但得到拒绝访问尝试

时将错误分配给变量。基本代码如下。基本上任何

的方式,我可以将输入的URL产生的html分配给我可以操作的

javascript变量或对象应该适用于

我。建议?

提前致谢

拉里


< html>

< form>

在此处粘贴URL:< input name = url value =''http://www.yahoo.com''>

< input type = button onclick = QUOT;尝试()" value = Go>

< input type = reset>

< / form>

< p id = here>< / p>

< script>

函数try(){

if(document.forms [0] .url.value ==' '''){return};

//用用户的url打开一个新窗口。


window2 = window.open(document.forms [0] .url.value,","" height = 0,width = 0");

//获取新网页的内容。下一行是获得

访问拒绝错误的行。


t = window2.document.body.innerHTML;


//显示此页面中的内容。


here.innerHTML = t;


//关闭新页面。 />

window2.close();


};


< / script>

< / html>

Hi all. I''m a bit of a novice in this arena so please forgive if this
question reflects that. I am trying to grab the html from a website and
display it within another webpage (once I get this to work I am going to
manipulate the html in other ways - this isn''t the end purpose of this
effort). To do this I am trying to open another window containing the
source html from a URL and then capture the html from that window. I
can open the window fine but get an "access denied" error when trying to
assign the html to a variable. The basic code follows. Basically any
way that I can assign the html that results from an entered URL to a
javascript variable or object that I can then manipulate should work for
me. Suggestions?
Thanks in advance
Larry

<html>
<form>
Paste URL here: <input name=url value=''http://www.yahoo.com''>
<input type=button onclick="try()" value=Go>
<input type=reset>
</form>
<p id=here></p>
<script>
function try() {
if (document.forms[0].url.value=='''') {return};
// open a new window with the url from the user.

window2=window.open(document.forms[0].url.value,"","height=0,width=0");
// get the content of the new page. NEXT IS THE LINE THAT GETS THE
ACCESS DENIED ERROR.

t=window2.document.body.innerHTML;

// display the content in this page.

here.innerHTML=t;

// close the new page.

window2.close();

};

</script>
</html>

推荐答案

Larry Asher写道:
Larry Asher wrote:
大家好。我在这个舞台上有点新手所以请原谅,如果这个问题反映了这个问题。我试图从网站上获取HTML并将其显示在另一个网页中
Hi all. I''m a bit of a novice in this arena so please forgive if this
question reflects that. I am trying to grab the html from a website and
display it within another webpage



http://jibbering.com/faq/#FAQ4_19


-

David Dorward< http://blog.dorward.me.uk/> < http://dorward.me.uk/>

首页是〜/ .bashrc的位置



http://jibbering.com/faq/#FAQ4_19

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is


它是'被称为内容窃取,是WWW中最古老和最严重的罪行。

这个群组不是新的窃贼信息来源。请尝试 www.astalavista.com



It''s called "content stealing", the oldest and the worst sin of WWW.
This group is not a new-thief info source. Try www.astalavista.com or
so.


VK写道:
它被称为内容窃取,是WWW中最古老和最严重的罪行。
这个小组不是一个新的小偷信息来源。请尝试 www.astalavista.com
It''s called "content stealing", the oldest and the worst sin of WWW.
This group is not a new-thief info source. Try www.astalavista.com or
so.



感谢您的回复。然而,仅仅因为内容窃取而

这个应用程序并不意味着它是唯一的一个。如果您感兴趣我们正在应用AI算法和遗传搜索技术

来分析大型

复杂企业内部网的语义表示和导航路径 - 经许可。困难的部分(AI

算法等)已经完成。我们只需要自动化浏览链接的过程。



Thank you for your reply. However, just because "content stealing" is
one application of this doesn''t mean it is the only one. If you are
interested we are applying AI algorithms and genetic search techniques
to analyze semantic representations and navigation paths of large
complex corporate intranets - WITH permission. The hard part (the AI
algorithms and such) is done. We just need to automate the process of
navigating through the links.


这篇关于从网站捕获和使用html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆