Whatever I set data-url or data-text to, twitter just fetches the URL of the page the sharing button exists in and shows as the tweet-text.
example :
<a target="_blank" href="https://twitter.com/share"
data-count="none" class="twitter-share-button" data-url="http://www.gogole.com"
data-text="BLABLABLA" style="opacity:0">TWEET</a>
or
<a target="_blank" href="https://twitter.com/share"
data-count="none" class="twitter-share-button" data-url="<?php echo
urlencode('http://www.gogole.com')?>" data-text="BLABLABLA" style="opacity:0">TWEET</a>
in both cases, clicking on the link opens a new window with the twitter sharing box that includes the URL of my website and ignores the attributes I set.
Something should have gone dangly wrong. help appreciated !
please tell me if you need more info to be posted.
Thanks,
/t
You can use the query parameter "url" with the twitter share link "https://twitter.com/share"
When looking for the URL twitter button follow this priority:
Look for url in the share link query string
If not found, look for the data-url attribute of the Tweet Button anchor tag
If not found, look for the rel="canonical" link tag in the head of the document
If not found use the URL of the webpage
I have faced same issue - when using link as described in manual's example it didnt work.
this NOT works:
<a class="twitterBtn smGlobalBtn" target=_blank href="https://twitter.com/share" data-text="my_title" data-url="my_url" data-hashtags="my_hash" data-via="my_name" data-related="my_name">Tweet</a>
but this WORKS:
<a class="twitterBtn smGlobalBtn" target=_blank href="https://twitter.com/share?text=my_text&url=my_url&hashtags=my_hash&via=my_name&related=my_name">Tweet</a>
Don't know why twitter ignores data- attributes, but when params are inside the link as GET params - everything works fine.
Hope this will be helpful for someone in future)
I fixed this by moving script widgets.js before button markup and turning off async mode, like this:
<script src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
<a href="https://twitter.com/share?ref_src=twsrc%5Etfw" class="twitter-share-button" data-text="H..." />
twitter-share-button class also important.
Related
I want to embed a tweet button on a webpage with a text an url but no original referrer. I've been trying with this:
<a class="twitter-share-button"
href="https://twitter.com/intent/tweet?text=Hello%20world" url="www.something.com">
Tweet</a>
But I each time end up with the name and url of my web page in the tweet. What's the correct syntax for what I want to do? Thanks.
The url parameter should be part of the Twitter intent (like text):
<a class="twitter-share-button"
href="https://twitter.com/intent/tweet?text=Hello%20world&url=www.something.com">
Tweet</a>
Check the documentation for web intents.
I would like to add a button to my website to give the opportunity to my visitors to share content to twitter and I use the following code :
<a href=
"https://twitter.com/intent/tweet?button_hashtag=TwitterStories&text=Check%20out%20this%20app%20"
class="twitter-hashtag-button" data-url="http://test.com">Tweet #TwitterStories</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
The problem is that the url's address is visible. I would like to add a link and display only a phrase (e.g "check this link") which will link to my website.
Is that possible?
Thanks in advance.
I've followed the guide here to add multiple widgets using the same widget id and this works perfectly fine for User timeline.
Snippet ----
<a class="twitter-timeline" href="https://twitter.com/benward" data-widget-id="[id]" data-screen-name="benward">
<a class="twitter-timeline" href="https://twitter.com/endform" data-widget-id="[id]" data-screen-name="endform">
<a class="twitter-timeline" href="https://twitter.com/kang" data-widget-id="[id]" data-screen-name="kang">
<a class="twitter-timeline" href="https://twitter.com/brianellin" data-widget-id="[id]" data-screen-name="brianellin">
What I would want to do is do the same( show different widgets ) for multiple hashtags - #MH17, #MH370 on the same page. But these tags change for each article on a page.
I want to know if either of these is possible.
Can I make the same guide available for a search query to this and this without creating a widget manually from the Twitter page. Timeline changes when I change the "data-screen-name" property. Is there something like "data-hashtag-name"?
Is it possible to use Twitter API or something to automate the process of creating a widget from the browser using Auth Token - Secret?
May be this help you .
Here i am sending you some example using this I am get json and render html div
Here is a sample code and demo you can use for search in twitter
1) http://www.codexworld.com/create-custom-twitter-widget-using-php/
2)you can also look into this examle may be this will full fill your requirement .
http://dev.kim-maida.com/twitter/
3) here is demo code and code sample link.
https://github.com/kmaida/twitter-timeline-php
did you see these pages?
https://dev.twitter.com/web/embedded-timelines/search
https://twitter.com/settings/widgets/new/search
You can do this:
corgi is the sample hashtag:
<a class="twitter-timeline" href="https://twitter.com/hashtag/corgi" data-widget-id="612280670367301632">#corgi Tweets</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
I have a "normal" link in my jqm page like this:
<a href="http://www.mysite.com/mobile/page.php?attribute=value">
And if I click it it won't properly refresh taking into account the attribute value and loading everything that's needed for it dynamically based on the attribute value. I understand that this is due to the fact that jqm tries to do an ajax call like mentioned here:
When you use pageChange an Ajax request will be made to that url and it will be
loaded only the content inside the div with data-role="page". So everything you
have out of this element will be ignored (JS and CSS).
So, I found out in the docs that I should use $.mobile.ajaxEnabled=false; or rel=external on links or target=_blank on the link.
Strange thing though for me is that only when I set the target=_blank property to my links will this truly happen. So, am wondering if someone had this kind of a problem and how did you solve it? The thing is, I would like to refrain myself form using target=_blank as it opens a new tab in my browser (as expected, but this is not nice from users' POV).
jqm version I use is 1.2
This question now at the top of google search results, so figured I'd answer:
Use the data-ajax attribute and set it to false to force reload upon clicking a link:
data-ajax="false"
use it like:
<a href="/" data-ajax="false">
<img id="mainLogo" src="logo.svg" width="215" />
</a>
And then your link will force reload the page!
Linking without Ajax
Links that point to other domains or that have rel="external",
data-ajax="false" or target attributes will not be loaded with Ajax.
Instead, these links will cause a full page refresh with no animated
transition. Both attributes (rel="external" and data-ajax="false")
have the same effect, but a different semantic meaning: rel="external"
should be used when linking to another site or domain, while
data-ajax="false" is useful for simply opting a page within your
domain from being loaded via Ajax. Because of security restrictions,
the framework always opts links to external domains out of the Ajax
behavior.
Parts taken from https://stackoverflow.com/a/22951472
Make function for the onclick event of the link.See the below code example.Hope this helps!
<script type="text/javascript">
function loadPage(url){
document.location.href = url;
}
<script/>
<a href="#" onClick="loadPage('http://www.mysite.com/mobile/page.php?attribute=value');">
I am a new coder/web designer and i am trying to add a the youtube logo that when clicked confirm subscription to the users channel
i have a php file with the following coding within...
<div id="youtube">
<img src="/images/YouTube.png />
</div>
this links to confirm subscription and the image directory is correct
however the problem is that whenever i add this into the coding it stuffs everything up!
if you go to any page and right click and go 'inspect element' you will see that the like box for facebook has a box around it which has the room for the youtube picture link
but it doesnt work, as said, when i add it in everything just clumps up together and/or the menu clumps up and goes all weird
You had two problems by the looks of things. The first issue was your include filename was wrong and the second was that you missed the closing inverted comma "
This was on the img src= tag
Try to change your id to something else - like <div id="youtube-confirm">
The youtube id might be reserved in FB script and it messes up your and their stuff