I can't tweet the description correctly if I want to make the design unique when I install the Twitter button.

Asked 2 years ago, Updated 2 years ago, 68 views

If you want to make the Twitter button unique, I think you will include a description in the URL parameter.However, if the description contains characters such as '&', '/' equivalent to htmlspecialchars, it will not appear correctly on the tweet screen.

<button onclick=
US>"window.open(encodeURI(http://twitter.com/share?text=The data created is "Ahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh&url=http://127.0.0.1/aaaaa/aaa')), 'window', 'width=650, height=470, personalbar=0, toolbar=0, scrollbars=1, sizable=1');"
class="btntwitter snsbuttons" >
    <div class="sns_button"><ic class="fa fa-twitter fa-2x">/i>strong>Tweet</strong>><div>
</button>

In fact, the URLs in the above code are dynamically generated.
Of course, if you don't encode '&', '%' for the URL, the tweet will be cut off in the middle.
Please let me know if there is any other good way to pass the parameters.

This is what happens

javascript php html twitter

2022-09-30 16:54

1 Answers

encodeURIComponent Why don't you just take care of what you need?

# (not verified)
varurl='https://twitter.com/intent/tweet?text='+
    encodeURIC component('Ai/Eo&Write')+
    '&url='+
    encodeURIComponent('https://www.example.com/aaaaa/aaa');


2022-09-30 16:54

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.