Two twitter timeline widgets in two different views - One loads the other doesn't

2 posts, 0 answers
  1. Gal
    Gal avatar
    3 posts
    Member since:
    Mar 2014

    Posted 05 Aug 2014 Link to this post


    I have the following views setup:

    <!-- 3.3 Twitter View -->
    <div data-role="view" id="DannyTwitter" data-init="twitterInit()" data-layout="twitterLayout">
        <a class="twitter-timeline" href="" data-widget-id="ID1" data-chrome="noheader nofooter">Tweets by @</a>      
    <!-- 3.4 Twitter View -->
    <div data-role="view" id="LindseyTwitter" data-layout="twitterLayout" data-init="twitterInit()">
        <a class="twitter-timeline" href="" data-widget-id="ID2" data-chrome="noheader nofooter">Tweets by @</a>

    And twitterInit() is just the standard timeline widget JS wrapped in a function:
    <script>function twitterInit(){ !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.src=p+"://";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");}</script>

    This works only if I switch between the two views BEFORE the timeline loads (when you can only see the "Tweets by @"). If I stay on one view and wait for the timeline then go to the next one, it's empty. It essentially creates the two iFrames, but the view that isn't displayed gets a blank iFrame while the one displayed has a timeline full iframe... Any ideas why this happens? I can attach images of the elements if you need it.
  2. Zdravko
    Zdravko avatar
    657 posts

    Posted 08 Aug 2014 Link to this post

    Hi Gal,

    In order to benefit from AppBuilder support service we kindly ask you to consider renewing your license.
    In the meantime we suggest using additional forums like StackOverflow and their community knowledge to find a solution for your case.


    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

Back to Top