<?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[Settings page problem of my extension.]]></title><description><![CDATA[<p dir="auto">Hello!<br />
I'm doing an extension, now I'm working on the settings page. My settings page work perfectly in local but when I try it on the extensions doesn't work. The problem is related to buttons, they doesn't go to the functions while on local they works.</p>
<p dir="auto">Two file download: <a href="https://dl.dropboxusercontent.com/u/22722558/Settings.zip" target="_blank" rel="noopener noreferrer nofollow ugc">https://dl.dropboxusercontent.com/u/22722558/Settings.zip</a></p>
<p dir="auto">Thanks for help <img src="https://forums.opera.com/assets/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=o7miklbo7rs" class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face" title=":)" alt="🙂" /></p>
]]></description><link>https://forums.opera.com/topic/6804/settings-page-problem-of-my-extension</link><generator>RSS for Node</generator><lastBuildDate>Wed, 11 Mar 2026 08:05:15 GMT</lastBuildDate><atom:link href="https://forums.opera.com/topic/6804.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 02 Dec 2014 12:51:15 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Settings page problem of my extension. on Tue, 16 Dec 2014 15:24:45 GMT]]></title><description><![CDATA[<p dir="auto">You are using inline scripts in the settings.html page (in form of <code>onclick="..."</code> element attributes) which is forbidden by default in extensions. There should be error messages about this in the developer tools console for the options page.</p>
<p dir="auto">The best way to fix this is to use <code>addEventListener</code> in settings.js to register the click event handlers on the appropriate elements.<br />
E.g. you can add the following code to your settings.js:</p>
<pre><code>function init() {
  document.getElementById('Button1').addEventListener('click', Save, false);
  document.getElementById('Button2').addEventListener('click', Load, false);
  document.getElementById('Button3').addEventListener('click', Default, false);
}

window.addEventListener('load', init, false);
</code></pre>
<p dir="auto">And remove the <code>onclick=...</code> stuff from the HTML.</p>
<p dir="auto">Inline scripts are forbidden in extensions by default for security reasons. You should put all your JavaScript code in JS files and not in HTML.<br />
You can read more about the Content Security Policy in extensions (and how to allow exceptions) in the documentation:</p>
<ul>
<li><a href="https://dev.opera.com/extensions/tut_architecture_overview.html#permissions_and_privileges" target="_blank" rel="noopener noreferrer nofollow ugc">https://dev.opera.com/extensions/tut_architecture_overview.html#permissions_and_privileges</a></li>
<li><a href="https://developer.chrome.com/extensions/contentSecurityPolicy" target="_blank" rel="noopener noreferrer nofollow ugc">https://developer.chrome.com/extensions/contentSecurityPolicy</a></li>
</ul>
]]></description><link>https://forums.opera.com/post/61695</link><guid isPermaLink="true">https://forums.opera.com/post/61695</guid><dc:creator><![CDATA[cinusek]]></dc:creator><pubDate>Tue, 16 Dec 2014 15:24:45 GMT</pubDate></item></channel></rss>