<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Add-on beginner question]]></title><description><![CDATA[<p dir="auto">I have looked at the Hellow World, pop up, and tabs developer pages.</p>
<p dir="auto">I am attempting to create a combination now without success.</p>
<p dir="auto">What I want is a popup, that has a link, when I click the link, it should update the current tab.</p>
<p dir="auto">So, I was thinking a script on the html page, using the script for tabs.</p>
<p dir="auto">There are obstacles:<br />
1 - the script code adds a listener. Can I add a listener to my link in the web page? I don't need a listener, I simply want to say, user clicked, you go and update the page.</p>
<p dir="auto">2 - the script is diabled by security. I have enabled tabs in the manifest but this is beyond that.</p>
<p dir="auto">I get:</p>
<p dir="auto">Refused to execute inline event handler because it violates the following content security policy directive: script-src self blob filesystem chrome-extension-resource. Either the unsafe-inline keyword, a hash sha256.. or a nonce nonce- is required to enable inline execution.</p>
<p dir="auto">Could you help me?</p>
<p dir="auto">(sorry for the double post)</p>
<p dir="auto">(if it matters I'm on opera 38)</p>
]]></description><link>https://forums.opera.com/topic/16098/add-on-beginner-question</link><generator>RSS for Node</generator><lastBuildDate>Tue, 12 May 2026 09:15:47 GMT</lastBuildDate><atom:link href="https://forums.opera.com/topic/16098.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 09 Jul 2016 19:20:58 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Add-on beginner question on Tue, 09 Aug 2016 00:09:34 GMT]]></title><description><![CDATA[<p dir="auto">First of all, you don't change url directly and you need permissions for tabs in your manifest file, to have access to tabs API<br />
add this to manifest.json file:</p>
<p dir="auto">"permissions": ["tabs"]</p>
<p dir="auto">Then when you wan't to change url in active tab, you have to do it in two steps,<br />
get active tabId and inside of callback function you can change url, like so:</p>
<p dir="auto">chrome.tabs.query({active: true}, function(tabs){<br />
chrome.tabs.update(tabs[0].id, {url: "your url here"}, function(){});<br />
});</p>
<p dir="auto">Anyway you should take a look at chrome's API:<br />
<a href="https://developer.chrome.com/extensions/tabs#method-query" target="_blank" rel="noopener noreferrer nofollow ugc">https://developer.chrome.com/extensions/tabs#method-query</a></p>
<p dir="auto">Hope that helps.  <img src="https://forums.opera.com/assets/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=gd9hk06g3u4" class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes" title=":D" alt="😃" /></p>
]]></description><link>https://forums.opera.com/post/104543</link><guid isPermaLink="true">https://forums.opera.com/post/104543</guid><dc:creator><![CDATA[kroppy]]></dc:creator><pubDate>Tue, 09 Aug 2016 00:09:34 GMT</pubDate></item><item><title><![CDATA[Reply to Add-on beginner question on Sat, 09 Jul 2016 23:10:48 GMT]]></title><description><![CDATA[<p dir="auto">thank you leoc, that was bc can't use onload trigger in page, so script tag had to come last in the html page.</p>
<p dir="auto">now back to original question, how do I from javascript referenced from my popup page, change location of active tab?</p>
<p dir="auto">the link in the popup page, calls a javascript function onclick, if I try to set chrome.tab[0].url the tab[0] is undefined</p>
]]></description><link>https://forums.opera.com/post/102778</link><guid isPermaLink="true">https://forums.opera.com/post/102778</guid><dc:creator><![CDATA[absolutelyfreeweb]]></dc:creator><pubDate>Sat, 09 Jul 2016 23:10:48 GMT</pubDate></item><item><title><![CDATA[Reply to Add-on beginner question on Sat, 09 Jul 2016 22:40:11 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto">my html is very simple, I don't know how to post the source in this forum.</p>
</blockquote>
<p dir="auto">Store it somewhere and put the link here.</p>
<p dir="auto">Maybe <a href="https://dev.opera.com/extensions/" target="_blank" rel="noopener noreferrer nofollow ugc">this page</a> has some info for you.</p>
]]></description><link>https://forums.opera.com/post/102777</link><guid isPermaLink="true">https://forums.opera.com/post/102777</guid><dc:creator><![CDATA[leocg]]></dc:creator><pubDate>Sat, 09 Jul 2016 22:40:11 GMT</pubDate></item><item><title><![CDATA[Reply to Add-on beginner question on Sat, 09 Jul 2016 21:09:58 GMT]]></title><description><![CDATA[<p dir="auto">when I enumerate the page with:<br />
for (i = 0; i &lt; document.all.length; i++) {<br />
alert(document.all[i].nodeName);</p>
<p dir="auto">I get:<br />
HTML, HEAD, STYLE, SCRIPT only...</p>
<p dir="auto">no body!!</p>
<p dir="auto">my html is very simple, I don't know how to post the source in this forum... O.O</p>
]]></description><link>https://forums.opera.com/post/102769</link><guid isPermaLink="true">https://forums.opera.com/post/102769</guid><dc:creator><![CDATA[absolutelyfreeweb]]></dc:creator><pubDate>Sat, 09 Jul 2016 21:09:58 GMT</pubDate></item><item><title><![CDATA[Reply to Add-on beginner question on Sat, 09 Jul 2016 20:47:07 GMT]]></title><description><![CDATA[<p dir="auto">ok so I put my javascript code outside the html to avoid security problems and do not get that error anymore, but it's like the js file does not access the html file. I've tried both:</p>
<p dir="auto">document.getElementById('linkspan').appendChild(link);<br />
document.getElementsByTagName("body")[0].appendChild(link)</p>
<p dir="auto">but get:</p>
<p dir="auto">uncaught typer error: Cannot read property appendChild of null<br />
uncaught typer error: Cannot read property appendChild of undefined</p>
]]></description><link>https://forums.opera.com/post/102768</link><guid isPermaLink="true">https://forums.opera.com/post/102768</guid><dc:creator><![CDATA[absolutelyfreeweb]]></dc:creator><pubDate>Sat, 09 Jul 2016 20:47:07 GMT</pubDate></item></channel></rss>