0
父的meta標籤我有以下內容的HTML文件獲取與iframe使用jQuery/JavaScript的
<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>
a.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從父頁面獲取元標記和父頁面圖像列表的內容。
$('meta[name=author]').attr("content"); does not work for me
這可能會幫助:http://stackoverflow.com/a/1133526/921204 - 更換'$(elementid) .attr(attributeName)'with'$('meta [name = author]')。attr(「content」)' – techfoobar
@techfoobar它返回undefined – user7282
你正在使用哪個版本的jquery? –