I have a page with an iframe and then sidebar links. The sidebar links lead to articles loaded within the iframe. Each sidebar link has a link like this “/news#1940,” where the number following the # tag corresponds to the ID of the article. I then am using the following jQuery to both load the news page on our site and then the appropriate article within the iframe.
var $news_story = $(window.location.hash.substring(1)),
$news_number = $news_story.selector,
$news_url = 'http://www.articleurlhere.com/ID=' + $news_number,
$news_url_default = 'http://www.main_news_feed_url_here.com';
var $url = location.pathname;
if ($news_number.length>0) {
$('#news-feed').attr('src', $news_url);
} else {
$('#news-feed').attr('src', $news_url_default);
}
This works great when you click on the sidebar links from an external page. It does not work however when you click on a sidebar link while on the news page (it changes the URL to the #number associated with the link, but does not reload the page or load the article in the iframe). Any ideas on how to make these links work while on the news page?
I think you need to call reload like this: