Here is the code I have to select a random news feed. What I want is to modify this to pick a random feed, but if the feed picked is the current feed to pick again.
<script>
var feeds = [
'http%3A%2F%2Ffeeds.skynews.com%2Ffeeds%2Frss%2Fus.xml',
'http%3A%2F%2Ffeeds.bbci.co.uk%2Fnews%2Fworld%2Frss.xml',
'https%3A%2F%2Fwww.nytimes.com%2Fsvc%2Fcollections%2Fv1%2Fpublish%2Fhttps%3A%2F%2Fwww.nytimes.com%2Fsection%2Fus%2Frss.xml',
'https%3A%2F%2Fwww.yahoo.com%2Fnews%2Frss',
'http%3A%2F%2Ffeeds.reuters.com%2FReuters%2FdomesticNews',
'http%3A%2F%2Ffeeds.washingtonpost.com%2Frss%2Frss_blogpost'
];
function randomFeed(feeds) {
return feeds[Math.floor(Math.random() * feeds.length)];
}
var feed = randomFeed(feeds);
var link = "<script language='JavaScript' src='http://feedroll.com/rssviewer/feed2js.php?src=" + feed + "&chan=title&num=4&desc=1&targ=y&utf=y&html=y' charset='UTF-8' type='text/javascript'><\/script>";
</script>
The only way I know what the current feed is, is what is showing on the page. How would I store that info in a javascript variable or some kind of marker that I can look at the next time the news is refreshed to see if the random pick is the same feed as what is currently displayed?