使用jQuery/Javascript从iframe中获取父级的元标记
Get meta tags of parent from iframe using jQuery/Javascript
我有一个HTML文件,其中包含以下内容
<html>
<head>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0" name="viewport">
<meta content="desc goes here" name="description">
<meta content="auth name" name="author">
<title>builder 1.0</title>
</head>
<body>
<iframe width="100%" height="100%" src="http://domain.com/a.html" name="cxsideframe" scrolling:'no';="" id="frame1" style="overflow:hidden;">
</iframe>
</body></html>
.html的内容是
<html>
<head>
<meta charset="utf-8">
<title>builder v1.0</title>
<body>
<img src="http://example.com/images/01._V397411194_.png" style="display:none" alt=""/>
<img src="http://example.com/images/V386942464_.gif" style="display:none" alt="" />
</body></html>
我需要知道一种方法,使用jQuery或javascript从父页面获取父页面html的元标签和图像列表的内容。
$('meta[name=author]').attr("content"); does not work for me
您可以使用document.getElementsByTagNames,然后操作数组返回的
var metas = document.getElementsByTagName("meta");
var imagesOnPage = document.getElementsByTagName("img")
相关文章:
- 在for循环中未获取JQuery/JavaScript对象值
- 点击获取jQuery上的href属性
- 如何获取jQuery Confirm(jConfirm)值并使用该值检查条件
- 通过传递的参数位置获取jQuery中图像的宽度
- MVC Syncfusion Grid-HTML EJ Grid-获取Jquery中所选行的主键
- 如何获取 jQuery 以触发本机自定义事件处理程序
- 如何获取 jQuery 回调触发返回值
- 如何在wordpress插件中获取jquery中的img url和文件url
- 我想知道如何只激活表单提交,而不获取jquery中ajax url的值
- 如何获取jQuery集合中的第k个元素..作为JQUERY元素
- 从aspx.cs页面获取jquery post中的Null响应而不是json
- 如何获取 jquery 变量 childeren
- 如何从每个对象获取jQuery的“title”和“url”值
- 如何动态获取jquery noConflict()的引用
- 用于获取jQuery元素或值的方法
- 获取jquery数组对象的第n项
- 获取jquery确认在函数中返回的结果
- 获取JQuery UI自动完成元素的索引
- 获取jQuery UI排序后的ID数组
- 获取 jQuery DataTable 中的元素