How can I copy a profile or post link into my clipboard

I am not able to copy my profile link onto my clipboard, so I can be able to share on whatsapp and Telegram.. 

  • 661
  • More
Replies (13)
    • Hello Nudoib Inc !

      Do you want to have the button which will add the current URL to the clipboard? If yes, then you need to create the additional menu item via Studio->Nvaiagation app and the javascript code which will process it.

      • What about the javascript code. How do I go about it 

        • You may enter the code like following to your Studio->Designer->Injections->Header area:

          function share_link()

          {

          var dummy = document.createElement('input'),

                    text = window.location.href;

                  document.body.appendChild(dummy);

                  dummy.value = text;

                  dummy.select();

                  document.execCommand('copy');

                  document.body.removeChild(dummy);

          }

          Then in the new menu item in the Navigation app, you need to add this function share_link() to the on click field of a new item.

          • please is this tested, Im afraid so it won't crash the site please 

            • UNA will not let you to crash the site from one raw block :-)

              • Your taking all the fun out of coding Leonid. 

                • LeonidS I tried doing this. It is not working. Is there something missing from the code that goes in the header area?

                  • Hello Tim Burleigh !

                    I re-checled and it works fine. Possible deal is in the wrong formatted code in my answer, I corrected it. And don't forget to set in the URL parameter of a new link the "javascript:void(0)" value;

                    • For novices like me - don't forget to put the script tags on either end of the injector code.

                      • This code only works some on the time. It would be much better for UNA to code this into the share options.

                        it has been a request since UNA 9.0 so we may need to wait for many more releases before the UNA team can include it as a priority.

                        https://una.io/page.php?i=item&id=40621

                        • Small update to share the link from the timeline feed. The code for the Studio->Designer->Injections:

                          <script language="javascript">

                           function share_link_timeline(sContentId)

                           {

                             var dummy = document.createElement('input');

                             dummy.value = $('#bx-timeline-item-timeline-feed-' + sContentId + ' a.bx-tl-item-meta-date').attr('href');

                             document.body.appendChild(dummy);

                             dummy.select();

                             document.execCommand('copy');

                             document.body.removeChild(dummy);

                           }

                          </script>

                          and the code for the "Onclick" attribute of a new menu item in the Studio->Navigation->Timeline->Item actions area:

                          share_link_timeline('{content_id}'); return false;

                          • Thank you @LeonidS , that works really well.

                            It would be nice if it closed the window on click or gave a notification that it has been copied. Is it possible?

                            • Well, it's possible to add the simple alert("Message"); line right after document.execCommand('copy');

                              But may not be the true result as execCommand is the deprecated feature of the browsers now.

                              Login or Join to comment.