gpt4 book ai didi

javascript - Jquery 更改元标记

转载 作者:行者123 更新时间:2023-11-29 19:46:35 25 4
gpt4 key购买 nike

我试图让这个元标记始终具有它所在页面的当前 URL。

<meta property="og:url" content="http://shop.famsf.org/do/product/BK5160" />

我将如何使用 JS 或 JQ 更改元标记?

最佳答案

Changing Facebook meta tag Content Attribute using JQuery

当然可以使用 jQuery 更改元标记,但我认为这不会实现您想要的,因为元标记是由 FB 抓取器提取的。 FB 抓取器出去并抓取您的页面以读取元标记。

Editing Meta Tags

You can update the attributes of your page by updating your page's tags. Note that og:title and og:type are only editable initially - after your page receives 50 likes the title becomes fixed, and after your page receives 10,000 likes the type becomes fixed. These properties are fixed to avoid surprising users who have liked the page already. Changing the title or type tags after these limits are reached does nothing, your page retains the original title and type.

For the changes to be reflected on Facebook, you must force your page to be scraped. The page is scraped when an admin for the page clicks the Like button or when the URL is entered into the Facebook URL Linter. You can programmatically force your page to be scraped by cURL'ing the linter. For example ...

https://developers.facebook.com/docs/opengraph/

但是如果你想这样做:

$('meta[property=og\\:url]').attr('content', window.location.href);

关于javascript - Jquery 更改元标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19100560/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com