Page 1 of 1
Why doesn't Twitter feed work on Safari?
Posted: Wed Nov 13, 2013 7:29 am
by simonmlewis
Code: Select all
<a class=\"twitter-timeline\" data-dnt=\"true\" href=\"https://twitter.com/anonymous\" data-widget-id=\"395906907610697729\" width=\"342\" height=\"500\" >Tweets by @anonymous</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>
This doesn't work on Safari on my iPad.
It begins to do it, by showing a bit of text, but then abandons it all, and stops all code after it running too.
I've since added code to only show when browser is not Safari - but why would it not show?
Re: Why doesn't Twitter feed work on Safari?
Posted: Wed Nov 13, 2013 8:21 am
by Celauran
Works fine for me. Safari 7.0/OSX 10.9
Re: Why doesn't Twitter feed work on Safari?
Posted: Wed Nov 13, 2013 8:26 am
by simonmlewis
On iPad Mini it fails.
Re: Why doesn't Twitter feed work on Safari?
Posted: Wed Nov 13, 2013 8:39 am
by Celauran
Just tested on my iPad. Works there too. That's the only thing I've got on the page, though, so I removed all the backslashes. Check for a missing/extra backslash?
Re: Why doesn't Twitter feed work on Safari?
Posted: Wed Nov 13, 2013 8:44 am
by simonmlewis
This is my section right now.
If I strip it out and just use the Twitter code, it fails.
Code: Select all
$ua = $_SERVER["HTTP_USER_AGENT"];
$safari = strpos($ua, 'Safari') ? true : false; // All Safari
if($safari)
{
}
else
{
echo "<td rowspan='2' style='padding-right: 15px'><a class=\"twitter-timeline\" data-dnt=\"true\" href=\"https://twitter.com/anonymous\" data-widget-id=\"395906907610697729\" width=\"342\" height=\"500\" >Tweets by @anonymous</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></td>";}
Re: Why doesn't Twitter feed work on Safari?
Posted: Wed Nov 13, 2013 8:49 am
by Celauran
echo block still works fine on Safari on OS X 10.9 and iOS 7
Re: Why doesn't Twitter feed work on Safari?
Posted: Wed Nov 13, 2013 8:52 am
by simonmlewis
Fine - doesn't for me on my iPad with the latest app software.
it begins to load it, then drops out it, and everything after it. On all other browsers, it works fine.
Re: Why doesn't Twitter feed work on Safari?
Posted: Wed Nov 13, 2013 8:58 am
by simonmlewis
Odd - if I echo it inside PHP tags on it's own, within our template, it works. But if it is in a <td> </td> it doesn't in Safari.
Re: Why doesn't Twitter feed work on Safari?
Posted: Wed Nov 13, 2013 9:01 am
by Celauran
I'm out of testing options. Copy/pasted the above into my local MAMP install and onto my Linux server, accessed both via OS X and iOS 7. Can't reproduce anywhere. Sorry.
Re: Why doesn't Twitter feed work on Safari?
Posted: Wed Nov 13, 2013 9:05 am
by simonmlewis
Well I just ran it on Safari on my laptop. The Twitter feed "overlays" the next cell. so I set the <td> that the Feed resides to be width='50%' to force it out, but STILL on my ipad is just say "no, not doing any more".
Re: Why doesn't Twitter feed work on Safari?
Posted: Wed Nov 13, 2013 9:12 am
by simonmlewis
It's definitely something to do with Twitter, and using it on an iPad.
If I run it even with the Twitter feed outside of the <?php ?> tags, it loads the whole page, and as it's about to load the feed, it then chucks everything from Twitter onwards down the whole page, out. And I get a white space.
I don't feel it's a Safari issue, as on my laptop Safari it runs nice. It's definitely the iPad at fault, or perhaps a cliche with the browser and the Twitter app ??
Re: Why doesn't Twitter feed work on Safari?
Posted: Wed Nov 13, 2013 9:17 am
by Celauran
I have Twitter app on my iPad as well and I'm not getting the issue. Nothing in your error logs?
Re: Why doesn't Twitter feed work on Safari?
Posted: Wed Nov 13, 2013 9:23 am
by simonmlewis
[Wed Nov 13 15:13:50 2013] [error] [client 59.63.181.81] PHP Notice: Undefined index: HTTP_USER_AGENT in /var/www/vhosts/site.co.uk/httpdocs/index.php on line 587
Only this. But this is only there now to help.
Without this, we either have the feed for those without Safari, or we don't have it at all.