使用jQuery从iframe中的网址获取标题字符串? [英] Get title string from url within iframe using jQuery?
本文介绍了使用jQuery从iframe中的网址获取标题字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道是否有可能在IFRAME中获取URL的页面标题.我试图使用jQuery $('#iframe').attr('title'),但这不起作用.请帮忙.谢谢.
I wonder if it is possible to get the page title of an url within IFRAME. I tried to use jQuery $('#iframe').attr('title') but that doesn't work. Please help. Thanks.
推荐答案
我认为这是您要寻找的:
I think this is what you're looking for:
$(document).ready(function()
{
alert($('#iframe').contents().find("title").text());
});
这将返回位于id为"iframe"的iframe文档的< title>
标记中的页面标题.
That will return the page title that is located in the <title>
tag of the iframe document that has the id "iframe".
这篇关于使用jQuery从iframe中的网址获取标题字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文