Facebook doesn't execute js code, it only reads the HTML as is. You'll maybe need to create a JSP that will be specific to facebook, this is not useless work since you need that job done for SEO too
gwt modify meta property to facebook share
-
15-10-2022 - |
题
Are there any solution to change html's meta property at run time in gwt?
I try to change meta properties:
JQuery.select("meta[property='og\\:url']").attr("content", builder.buildString());
JQuery.select("meta[property='og\\:title']").attr("content", Window.getTitle());
JQuery.select("meta[property='og\\:video']").attr("content", videoURL);
JQuery.select("meta[property='og\\:image']").attr("content", pictureURL);
and when I check:
Window.alert(" url: " +JQuery.select(("meta[property='og\\:url']")).attr("content") + " title: "+ JQuery.select(("meta[property='og\\:title']")).attr("content") + " video: " + JQuery.select(("meta[property='og\\:video']")).attr("content") + " image: " + JQuery.select(("meta[property='og\\:image']")).attr("content") );
the popup shows the correct new meta properies, but when I try to share, facebook use the old meta values.
解决方案
不隶属于 StackOverflow