通过 IFRAME 引用 url 中的特定 TAG - jQuery/PHP

Refer to a particular TAG in url via IFRAME - jQuery/PHP

我想知道我是否可以通过 Iframe 中的 link 定向 (Src) 引用特定标签(在我们的示例 H1 中)。

例如 link http://www.marketwatch.com/story/what-the-fed-raising-rates-would-mean-for-your-credit-cards-and-bank-accounts-2016-12-14

我想知道我是否可以参考下面link中的第一个H1("How the Fed rate hike will impact millions of Americans")主要目的是直接看文章。

<iframe id="iFrame1" scrolling="no" src="http://www.marketwatch.com/story/what-the-fed-raising-rates-would-mean-for-your-credit-cards-and-bank-accounts-2016-12-14#H1" style="overflow: scroll; -webkit-overflow-scrolling: touch;" sandbox=""></iframe>

假设您的意思是您希望 iframe 向下滚动到 h1 标记,您可以向 URL 添加一个片段,该片段与 id 属性相匹配所需的元素。在本例中为 #article-headline。试试这个:

<iframe id="iFrame1" scrolling="no" src="http://www.marketwatch.com/story/what-the-fed-raising-rates-would-mean-for-your-credit-cards-and-bank-accounts-2016-12-14#article-headline" style="overflow: scroll; -webkit-overflow-scrolling: touch;" sandbox=""></iframe>