如何使用JQuery / JS获取给定url(外部URL)的网页标题 [英] How can I get the title of a webpage given the url (an external url) using JQuery/JS
问题描述
所以我在尝试的是使用JQuery / JavaScript来获取URL的标题, JS。我不想加载网址的内容,然后解析标签。
让我更清楚一点,我有一组网址,说20想要显示标题..
我指的网址不是当前的网址,所以我不能使用js document.title ..
所以我想要做一些SOMEFUNC.title(URL)的形式并获得它的标题。是否有这样的功能?
您也可以使用此API获取任何网页的标题
http://textance.herokuapp.com/title/ p>
$。ajax({
url:http://textance.herokuapp.com/title/www.bbc。
complete:function(data){
alert(data.responseText);
}
});
I am a newbie, so excuse me if this is a silly question ..
So what I was trying is to get the title of a URL using JQuery/JS. I dont want to load the content of the url and then parse tags in it.
Let me be more clear, I have a set of urls, say 20 for which I want to display the titles .. the urls i am referring to are not the current urls, so I cant use js document.title ..
so i want to do something of the form SOMEFUNC.title(URL) and get its title. Is there any such function?
You can also get the title of any webpage using this API
http://textance.herokuapp.com/title/
$.ajax({
url: "http://textance.herokuapp.com/title/www.bbc.co.uk",
complete: function(data) {
alert(data.responseText);
}
});
这篇关于如何使用JQuery / JS获取给定url(外部URL)的网页标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!