在WP模板中,我正在通过iFrame加载YouTube播放列表。我上面有一个选择框,允许用户选择另一个播放列表。看起来很简单,但我一直遇到浏览器安全问题。
jQuery(document).ready(function() {
$('#channelChooser').change(function() {
$(this).next('iframe').attr('src', this.value);
});
});

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select name="channelChooser" id="channelChooser">
<option value="https://www.youtube.com/playlistlist=one">One</option>
<option value="https://www.youtube.com/playlist?list=Two">Two</option>
<option value="https://www.youtube.com/playlist?list=Three">Three</option>
</select>
<iframe id="ytplayer" type="text/html" width="720" height="405" src="https://www.youtube.com/embed/?enablejsapi=One&listType=playlist" frameborder="0" allowfullscreen></iframe>
&#13;
我收到此错误:
拒绝展示&#39; https://www.youtube.com/playlist?list=Two&#39;在一个框架中因为它设置了X-Frame-Options&#39;到#sameorigin&#39;。
我只是希望能够在select上更改youtube播放列表,最好不要插入,因为这应该很简单。谢谢!
答案 0 :(得分:1)
<Results>
<ResultSet fetchSize="0">
<Row rowNumber="1">
<HANDLE>ClarificationCode</HANDLE>
<KEY1>01</KEY1>
<KEY1DESC>qqq</KEY1DESC>
</Row>
<Row rowNumber="2">
<HANDLE>ClarificationCode</HANDLE>
<KEY1>02</KEY1>
<KEY1DESC>www</KEY1DESC>
</Row>
<HANDLE>ClarificationCode</HANDLE>
<KEY1>10</KEY1>
<KEY1DESC>ttt</KEY1DESC>
[there are almost 50 rows displayed with different KEY1 and KEYDESC values for the same handle]
</ResultSet>
</Results>
来阻止clickjacking。您需要嵌入实际的播放列表。