Html 我如何编写能够在网站上找到标题的代码

Html 我如何编写能够在网站上找到标题的代码,html,web-crawler,Html,Web Crawler,我如何编写一些东西,让它进入网站并查找标题标签,然后显示数据?试试以下方法: HTML <div id="hi"></div> JS(带JQuery) $.ajax({ 网址:'https://crossorigin.me/' + 'https://myurl.com', 类型:'GET', 成功:功能(数据){ var x=“”; x=数据。替换(/[^]*/,“”); x=x.replace(/[^]*/,“”) $(#hi”).html(x); } });

我如何编写一些东西,让它进入网站并查找标题标签,然后显示数据?

试试以下方法:

HTML

<div id="hi"></div>

JS(带JQuery)

$.ajax({
网址:'https://crossorigin.me/' +
'https://myurl.com',
类型:'GET',
成功:功能(数据){
var x=“”;
x=数据。替换(/[^]*/,“”);
x=x.replace(/[^]*/,“”)
$(#hi”).html(x);
}
});

演示:

使用HTML或XML解析器。谢谢,这是我需要的:)
$.ajax({
url:'https://crossorigin.me/' +
    'https://myurl.com',
    type:'GET',
    success: function(data){
       var x = "";
       x = data.replace(/[^]*<title>/,"");
       x = x.replace(/<\/title>[^]*/,"")
       $("#hi").html(x);
    }
});