News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Sharing a post to reddit is only submitting a partial URL

Started by Wellwisher, January 23, 2021, 08:46:23 PM

Previous topic - Next topic

Wellwisher

I am making a social Reddit share button. The issue is when I click on "Share on Reddit" it only records a partial SMF topic post URL on reddit EXAMPLE.

Here's my JSfiddle example which replicates the issue:

https://jsfiddle.net/doLwkc92/

So on reddit if the actual forum post url is say for EXAMPLE:

"https://www.website.com/forum/index.php?topic=876.msg104178%23msg104178"

When shared on reddit, it only records:

"https://www.website.com/forum/index.php"

However here's where it gets interesting, when a user shares a forum post on reddit, it doesn't "submit" the full post URL, but if they refresh the reddit page (once u share it), it fixes itself automatically.  :-\


Below is the actual PHP code used in my forum:



<li><a href="https://www.reddit.com/submit?title='. urlencode($context['subject']) .'&amp;url=', $scripturl, '?topic=', $context['current_topic'], '.msg' . $message['id'] . '%23msg' . $message['id'] . '" title="Share on Reddit" target="_blank"><i class="fa  fa-reddit-alien"></i></a></li>



I believe the problem may be the "URL decoder" not working properly on Reddit but not sure.

Kindred

Its a reddit problem with the ? and & argument notations
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Wellwisher

#2
Quote from: Kindred on January 23, 2021, 08:57:52 PM
Its a reddit problem with the ? and & argument notations

Ah thank you @Kindred, so I wasn't going crazy, I suspected it as much because when you refresh the reddit page, it fixes itself.

It's the "?", "&", "=" that's throwing reddit off.

Is there a fix for this issue?

Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Wellwisher

Quote from: Kindred on January 23, 2021, 09:08:24 PM
It's not an smf problem

You could use pretty URLs

It's a neat idea. I would as it's a clever little add on. However it doesn't play well with SMF updates and other addons made for SMF.

Thank you for your input Kindred, as usual I really appreciate it. I will submit a bug report to reddit.  :P Much respect mate.

Advertisement: