Note that there are some explanatory texts on larger screens.

plurals
  1. POOpening tabs in Chrome news reader extension
    primarykey
    data
    text
    <p>I'm trying to create a simple chrome extension using the following google RSS reader sample,</p> <p><a href="http://code.google.com/chrome/extensions/samples.html#597015d3bcce3da693b02314afd607bec4f55291" rel="nofollow">http://code.google.com/chrome/extensions/samples.html#597015d3bcce3da693b02314afd607bec4f55291</a></p> <p>I can add links in the pop-up window that open tabs, but not from the feeds themselves.</p> <p>Looping through the items in the feed, grabbing title tags and link tags, I want the title to link the the appropriate sites </p> <pre><code> var entries = doc.getElementsByTagName('item'); var count = Math.min(entries.length, maxFeedItems); for (var i = 0; i &lt; count; i++) { item = entries.item(i); // Grab the title for the feed item. var itemTitle = item.getElementsByTagName('title')[0]; if (itemTitle) { itemTitle = itemTitle.textContent; } else { itemTitle = "Unknown title"; } // Grab the link for this feed item var itemLink = item.getElementsByTagName('link')[0]; if (itemLink) { itemLink = itemLink.textContent; } else { itemLink = "Unknown link"; } var title = document.createElement("a"); title.className = "item_title"; title.innerText = itemTitle; //display title in iframe title.addEventListener("click", titleLink); // should open link when clicking on title, but does not. } // ------------------------------------------------------------------- // Show |url| in a new tab. function showUrl(url) { // Only allow http and https URLs. if (url.indexOf("http:") != 0 &amp;&amp; url.indexOf("https:") != 0) { return; } chrome.tabs.create({url: url}); } function moreStories(event) { showUrl(moreStoriesUrl); } function titleLink(event) { showUrl(itemLink); } </code></pre> <p>Any thoughts on why this is not working.</p> <p>If I replace title.addEventListener("click", titleLink); with title.addEventListener("click", moreStories); each title will link to moreStories, I cannot get each title to link to itemLink.</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload