Page 1 of 1

Need a copy url button using WYSIWYG buttons?

Posted: Sun May 15, 2022 11:14 pm
by Angelo
I need help with creating a copy url button using WYSIWYG buttons, is the Possible? Thanks

Re: Need a copy url button using WYSIWYG buttons?

Posted: Mon May 16, 2022 5:43 am
by Pablo
What is a 'copy URL button'?

Re: Need a copy url button using WYSIWYG buttons?

Posted: Mon May 16, 2022 7:05 am
by BaconFries

Re: Need a copy url button using WYSIWYG buttons?

Posted: Mon May 16, 2022 11:23 am
by wwonderfull
I already did a successful experiment for the copy url button in WWB and it is functioning absolutely perfectly. If you still need help understanding you can ask if any help needed.

Re: Need a copy url button using WYSIWYG buttons?

Posted: Mon May 16, 2022 1:25 pm
by Angelo
wwonderfull wrote: Mon May 16, 2022 11:23 am I already did a successful experiment for the copy url button in WWB and it is functioning absolutely perfectly. If you still need help understanding you can ask if any help needed.
Yes Please and thank you :)

Re: Need a copy url button using WYSIWYG buttons?

Posted: Mon May 16, 2022 1:40 pm
by wwonderfull
Angelo wrote: Mon May 16, 2022 1:25 pm
wwonderfull wrote: Mon May 16, 2022 11:23 am I already did a successful experiment for the copy url button in WWB and it is functioning absolutely perfectly. If you still need help understanding you can ask if any help needed.
Yes Please and thank you :)
Image

Take an editbox rename the ID to myInput Go to button properties and then check read only and in the value give your own URL as I have given https://example.com you give your url

then take a button go to events of the button and on click select javascript then paste

myFunction()

after select that button go to Object HTML and go to Custom Style and paste the below code

Code: Select all

<script>
function myFunction() {
  /* Get the text field */
  var copyText = document.getElementById("myInput");

  /* Select the text field */
  copyText.select();
  copyText.setSelectionRange(0, 99999); /* For mobile devices */

  /* Copy the text inside the text field */
  navigator.clipboard.writeText(copyText.value);
  
  /* Alert the copied text */
  alert("Copied the text: " + copyText.value);
}
</script>

Re: Need a copy url button using WYSIWYG buttons?

Posted: Mon May 16, 2022 1:49 pm
by Angelo
Thank you very much for your help

Re: Need a copy url button using WYSIWYG buttons?

Posted: Mon May 16, 2022 1:52 pm
by wwonderfull
Angelo wrote: Mon May 16, 2022 1:49 pm Thank you very much for your help
Did it work the way you wanted?

Re: Need a copy url button using WYSIWYG buttons?

Posted: Mon May 16, 2022 2:09 pm
by Angelo
wwonderfull wrote: Mon May 16, 2022 1:52 pm
Angelo wrote: Mon May 16, 2022 1:49 pm Thank you very much for your help
Did it work the way you wanted?
Yes it works Perfect. Is there also a way to copy URL without having the text box and have just the button?

Re: Need a copy url button using WYSIWYG buttons?

Posted: Mon May 16, 2022 2:11 pm
by wwonderfull
Yes it works Perfect. Is there also a way to copy URL without having the text box and have just the button?

I might have to do some experiment for that but yes it may be possible :D

Re: Need a copy url button using WYSIWYG buttons?

Posted: Mon May 16, 2022 2:18 pm
by Angelo
wwonderfull wrote: Mon May 16, 2022 2:11 pm
Yes it works Perfect. Is there also a way to copy URL without having the text box and have just the button?

I might have to do some experiment for that but yest it may be possible :D
Thank you very much and do you have a site to where I can donate for your help?

Re: Need a copy url button using WYSIWYG buttons?

Posted: Mon May 16, 2022 6:45 pm
by wwonderfull
Thank you very much and do you have a site to where I can donate for your help?
You can donate here https://www.buymeacoffee.com/wysiwygwb

and for your button
Take a button go to events of the button and on click select javascript then paste

copyText()

Select the button go to Object HTML go to custom styles paste the code written below "Change This Text With Your Link Your URL" change this text with the url you want and its done. It does not alert but it does copy the text.

Code: Select all

<script>
function copyText() {
navigator.clipboard.writeText
("Change This Text With Your Link Your URL");
}
</script>
Update: There is a way to do an alert on the browser the experiment was successful. Request if you need the alert function

For the SImple Alert on Browser You can use this script instead

"URL Has Been Copied" You can put any text there

Code: Select all

<script>
function copyText() {
navigator.clipboard.writeText
("Change This Text With Your Link Your URL");
alert("URL Has Been Copied");
}
</script>
The editbox one seems better on my view but your wish :)

Re: Need a copy url button using WYSIWYG buttons?

Posted: Mon May 16, 2022 6:55 pm
by Angelo
Great work thanks again very much appreciate it!

Re: Need a copy url button using WYSIWYG buttons?

Posted: Mon May 16, 2022 9:07 pm
by VictorKrs
Good evening! Unfortunately, the proposed solution does not work for me: (I can see I'm doing something wrong :( But the "copying URL to clipboard" event itself seems to me worthy of attention. If Pablo adds this event to the standard functionality of the program, it would be great! As a development of the topic... when onclick is copied, not only the URL can be copied to the e-mail and not only for the button...

Re: Need a copy url button using WYSIWYG buttons?

Posted: Tue May 17, 2022 1:39 am
by wwonderfull
VictorKrs wrote: Mon May 16, 2022 9:07 pm Good evening! Unfortunately, the proposed solution does not work for me: (I can see I'm doing something wrong :( But the "copying URL to clipboard" event itself seems to me worthy of attention. If Pablo adds this event to the standard functionality of the program, it would be great! As a development of the topic... when onclick is copied, not only the URL can be copied to the e-mail and not only for the button...
Which method did you try, was it the edit box one or just the button one? Share a demo file for further assistance ty.

Re: Need a copy url button using WYSIWYG buttons?

Posted: Wed May 18, 2022 7:47 pm
by VictorKrs
wwonderfull wrote: Tue May 17, 2022 1:39 am
VictorKrs wrote: Mon May 16, 2022 9:07 pm Good evening! Unfortunately, the proposed solution does not work for me: (I can see I'm doing something wrong :( But the "copying URL to clipboard" event itself seems to me worthy of attention. If Pablo adds this event to the standard functionality of the program, it would be great! As a development of the topic... when onclick is copied, not only the URL can be copied to the e-mail and not only for the button...
Which method did you try, was it the edit box one or just the button one? Share a demo file for further assistance ty.
Good evening, Wonderful! Thank you for your help!
Link to the file of my failed project
https://cloud.mail.ru/public/crMJ/pZp84bFun
I will be grateful if you write what the error is!

Re: Need a copy url button using WYSIWYG buttons?

Posted: Thu May 19, 2022 7:45 am
by wwonderfull
Good evening, Wonderful! Thank you for your help!
Link to the file of my failed project
https://cloud.mail.ru/public/crMJ/pZp84bFun
I will be grateful if you write what the error is!
Image
Note: That the success happened when I copied and pasted the button, editbox and script on my WWB Project, the one you provided had issues.

The demo you gave me everything works absolutely perfect for me there was no problem on the script.
BUT...
When I publish it in my browser it previews in a different location which is file:///E:/Temp/WWBPreviewFiles/index.html
Make all the settings default and also use a new Untitled.wbs project and see if it works. The script has no problem at all, the preview location has problem; it even did not publish on my local publish folder. So I hope making everything default on the settings might fix everything.

Re: Need a copy url button using WYSIWYG buttons?

Posted: Mon May 23, 2022 9:07 pm
by VictorKrs
wwonderfull wrote: Thu May 19, 2022 7:45 am
Good evening, Wonderful! Thank you for your help!
Link to the file of my failed project
https://cloud.mail.ru/public/crMJ/pZp84bFun
I will be grateful if you write what the error is!
Image
Note: That the success happened when I copied and pasted the button, editbox and script on my WWB Project, the one you provided had issues.

The demo you gave me everything works absolutely perfect for me there was no problem on the script.
BUT...
When I publish it in my browser it previews in a different location which is file:///E:/Temp/WWBPreviewFiles/index.html
Make all the settings default and also use a new Untitled.wbs project and see if it works. The script has no problem at all, the preview location has problem; it even did not publish on my local publish folder. So I hope making everything default on the settings might fix everything.
Good evening!
Thank you for your help!