I'm trying to implement a Facebook share button in my Next.js application with a pre-filled Arabic hashtag, but I'm running into an issue.
Here is the code I'm using:
const handleShare = (e) => {
e.preventDefault();
if (score) {
const shareParams = new URLSearchParams({
u: shareUrl,
hashtag: "#هاشتاگێکی_دیاریکراو",
}).toString();
const fbShareUrl = `.php?${shareParams}`;
// Open share dialog
window.open(
fbShareUrl,
"_blank",
"width=600,height=400,left=" +
(window.innerWidth - 600) / 2 +
",top=" +
(window.innerHeight - 400) / 2
);
}
};
The issue is that when I click the hashtag in Facebook after sharing the post, the URL of the hashtag changes. For example, this is what I get:
The added ?__eep__=6
parameter breaks the hashtag. If I manually remove ?eep=6 from the URL in the browser, the hashtag works correctly.
I have tried these approaches:
- Encoding the hashtag
(encodeURIComponent("#هاشتاگێکی_دیاریکراو"))
- Removing the
#
sign
Still none of these works.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742354843a4428224.html
评论列表(0条)