使用jquery从javascript获取iframe页面标题 [英] get iframe page title from javascript using jquery

查看:804
本文介绍了使用jquery从javascript获取iframe页面标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获得iframe的src页面标题,然后设置主页标题

解决方案

如果你想使用jQuery:

  var title = $(#frame_id)。contents()。find(title)。html(); 
$(document).find(title)。html(title);

只有当网页位于同一个网域时才可以使用,否则就没用了。


How to get iframe src page title and then set main page title

解决方案

If you want to do it using jQuery:

var title = $("#frame_id").contents().find("title").html();
$(document).find("title").html(title);

You can do it only when pages are on the same domain, otherwise it's useless.

这篇关于使用jquery从javascript获取iframe页面标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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