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..
-
-
·
LeonidS
- ·
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.
-
·
LeonidS
-
- · Abbey
- ·
What about the javascript code. How do I go about it
-
-
·
LeonidS
-
·
In reply to Abbey
- ·
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.
-
·
LeonidS
-
- · Abbey
- ·
please is this tested, Im afraid so it won't crash the site please
-
-
·
LeonidS
-
·
In reply to Abbey
- ·
UNA will not let you to crash the site from one raw block :-)
-
·
LeonidS
-
- · Dawgcom
- ·
Your taking all the fun out of coding Leonid.
-
- · Tim
-
·
In reply to LeonidS
- ·
LeonidS I tried doing this. It is not working. Is there something missing from the code that goes in the header area?
-
-
·
LeonidS
-
·
In reply to Tim
- ·
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;
-
·
LeonidS
-
For novices like me - don't forget to put the script tags on either end of the injector code.
-
- · InPage
-
·
In reply to LeonidS
- ·
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.
-
-
·
LeonidS
- ·
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;
-
·
LeonidS
-
- · InPage
-
·
In reply to LeonidS
- ·
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?
-
-
·
LeonidS
-
·
In reply to InPage
- ·
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.
-
·
LeonidS