javascript - Arabic Hashtag in Facebook Sharer Adds Unwanted Characters (e.g., ?__eep__=6) - Stack Overflow

I'm trying to implement a Facebook share button in my Next.js application with a pre-filled Arabic

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:

  1. Encoding the hashtag (encodeURIComponent("#هاشتاگێکی_دیاریکراو"))
  2. Removing the # sign

Still none of these works.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742354843a4428224.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信