Share entered values while sharing a link

here is my problem: It would be great if users could not only share the link to my website, but also the values they entered there. So far, so good.

First try: simply submit values by GET.

Does not work because: if the URL is

domain.com?param1=a&param2=b

then simply the part before the ? will be shared (at least on iPhones, but that's bad.) So they just share

domain.com

and no parameters are sent. (Google told me the same without giving me a proper workaround idea.)

Okay. Second try: Some workaround involving .htaccess and history.pushstate. It worked quite well, but history.pushstate does not seem to affect the shared URL on iPhones either.

That's bad so far. Does maybe anyone have an idea what to use to solve my problem? Thank you very much :)

2 answers

  • answered 2022-01-25 14:28 Matt Roland

    It is correct to share domain.com?param1=a&param2=b. GET Parameters will be maintained.

  • answered 2022-02-06 08:09 Hobbycoder

    btW: I found a solution by myself:

    The shared URL is the one set in the

    <link rel="canonical" href="domain.com?param1=a&param2=b">
    

    So if I share, the parameters are ignored if they are not found in the canonical link.

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum