Search code examples
operaopera-extension

Install Opera extension from registry


I have developed a Opera extension. It's working fine. But I need to install my extension in the Windows registry or Windows file system. How can I to do this?


Solution

  • NOTE: THIS QUESTION IS OPERA 12 RELATED
    Opera 12 uses another extension architecture than the following Opera versions!

    Opera extensions aren't installed via the registry.

    You will find a XML-file called widget.dat in the folder:

    C:\Users\%Username%\AppData\Local\Opera\Opera\widgets
    

    Each widget has an entry there. I think you'll understand the syntax yourself, it is quite self-explaining if you have some widgets installed.


    EDIT: I just found out that adding a new entry to widget.dat will install the extension to Opera, but it will be deactivated as it hasn't been initialised. This usually happens through the javascript/extension engine during runtime.

    To enable the script manually, there must be a prefs.dat in the folder wuid-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx noted in the widget.dat, containing at least the following structure:

    <?xml version="1.0" encoding="utf-8"?>
    <preferences>
      <section id="ui">
        <value id="default-prefs-applied" xml:space="preserve">1</value>
      </section>
    </preferences>
    

    Additionally to that, you may have to manually initialise the widget settings within the pstorage folder. The settings are stored as base64-encoded utf-16 key-value pair strings. So, this encoded structure:

    <ws>
      <e>
        <k>YQBsAGUAcgB0AF8AYgB1AGIAYgBsAGUAXwB0AGkAbQBlAG8AdQB0AA==</k>
        <v>IgAxADUAIgA=</v>
      </e>
    <ws>
    

    Reads as:

    <widgetsettings>
      <entry>
        <key>alert_bubble_timeout</key>
        <value>"15"</value>
      </entry>
    <widgetsettings>
    

    (Tag names are freely interpreted ;) I found a base64 en/decoder capable of processing utf-16 here


    PS: Opera will install widgets by double-clicking them. So you could also execute Opera with the extensions path on the commandline. Opera will do everything for you then.

    C:\Program Files\Opera\opera.exe C:\Path\To\Extension.oex