Saying hello world to Opera extensions!

Forums » Dev.Opera » Archived Article Discussions

This topic has been closed. No new entries allowed.

Reason: You can now post comments on articles on Dev Opera

Forum rules and guidelines

You need to be logged in to post in the forums. If you do not have an account, please sign up first.

21. October 2010, 09:09:37

Opera Software

dstorey

Posts: 237

Saying hello world to Opera extensions!

In this tutorial we give you a basic walkthrough to create the classic Hello World, using Opera extensions.

( Read the article )

<q>Knowledge speaks, but wisdom listens.</q> - Jimi Hendrix

David Storey, Chief Web Opener, Product Manager Opera Dragonfly, Opera Software ASA

21. October 2010, 11:01:08

Opera Software

chrismills

Posts: 379

Originally posted by Lex1:

Error in the code:



Fixed.
Chris Mills
Developer Relations Manager
Editor, dev.opera.com and labs.opera.com

21. October 2010, 12:24:35 (edited)

DVD

Posts: 26

chrome vs opera badge http://twitpic.com/2zguts

23. October 2010, 05:56:57

shoust

Operaised

Posts: 3197

Is there currently any way to close the popup by a script?
My Opera I burning the E
Thats the way it should always B.
smile

23. October 2010, 07:55:35

fearphage

Trained Swordsman of Unwanted Opera Termination

Posts: 2234

Originally posted by shoust:

Is there currently any way to close the popup by a script?

I think he meant programatically. I've been looking for this answer myself. It seems the popup can't close itself and the background page can't close it either.
Always latest weekly; XP Pro SP2
My bugs / disable RSS subscription prompt (This will disable email and chat as well) / Receive emailed copies of your bug reports

quote from desktopteam blog Feb 23 2007 06:49.36 (direct link to comment)

Originally posted by borg:

we will not be satisfied before we have the best developer tools in the industry

Source: Mozilla Links - 5 things I’d like to see in Opera

Originally posted by Percy Cabello:

One of the main reasons I prefer Firefox is that it starts from the belief that it can’t be the ideal browser for everybody

23. October 2010, 09:54:17

Dodo87

Posts: 6

In the article "Opera extensions: buttons, badges and popups" it says: "Be aware that if you change the href property while the popup is open then the popup will close." (http://dev.opera.com/articles/view/opera-extensions-buttons-badges-and-popups/#popup_contents).

23. October 2010, 10:32:58

Lex1

Posts: 1718

Another problem with popup. If popup is opened, extension.tabs.getFocused() returned null. I tried to use this code, but it's seems ugly:

	   var extension = window.opera.extension, tab = '';
	   extension.onmessage = function(e){
		if(e.data && extension.tabs.getFocused())tab = extension.tabs.getFocused();

http://ruzanow.ru/opera/extensions/google-translate.oex

26. October 2010, 06:23:20

Opera Software

chrismills

Posts: 379

Originally posted by Lex1:

Another problem with popup. If popup is opened, extension.tabs.getFocused() returned null. I tried to use this code, but it's seems ugly: var extension = window.opera.extension, tab = '';
extension.onmessage = function(e){
if(e.data && extension.tabs.getFocused())tab = extension.tabs.getFocused();




From one of our developers: If you want to communicate with a popup, messages can be used. To change it's content do it through the background process. If you want to get a reference to a popup using extension.tabs.getFocused() it won't work, hence the null object.
Chris Mills
Developer Relations Manager
Editor, dev.opera.com and labs.opera.com

26. October 2010, 08:35:34

Lex1

Posts: 1718

getFocused()


Very bugged. It not worked when the page isn't completely loaded: «Uncaught exception: TypeError: 'tab.postMessage' is not a function»

Also if you use back/forward on the pages what's contain iframes: http://dev.opera.com/forums/findpost.pl?id=7454462

If you want to communicate with a popup, messages can be used.


I want to communicate with userjs in the current page. From popup.

29. October 2010, 23:55:59

fetis

Posts: 199

how can I develop extension w/o putting it every time in .oex archive?

5. November 2010, 22:44:00

infostations

Posts: 1

i copied everything you guys told me to do and i dragged my new file after zipping it to the browser and it said "Installation Failed" even when i make my own but when i download the already made one it works

16. November 2010, 02:35:23

Opera Software

zibin

Posts: 71

Originally posted by infostations:

i copied everything you guys told me to do and i dragged my new file after zipping it to the browser and it said "Installation Failed" even when i make my own but when i download the already made one it works



did you zip the contents? or the folder of the contents? it should be the former.

16. November 2010, 02:36:53

Opera Software

zibin

Posts: 71

Originally posted by fetis:

how can I develop extension w/o putting it every time in .oex archive?



this is the only way now, but we're making changes so that it's easier in the next iteration. Maybe in the form of widgets style installation where you can drag your config.xml only. or maybe some other ways.

16. November 2010, 19:08:05

QuHno

read a book!

Posts: 988

Originally posted by desktopteam blog:

For extensions developers, from now on if you drag'n'drop extension's config.xml file onto Opera a separate list is created in Extensions Manager which is titled 'Developer mode'. Each entry on this list has additional buttons: 'Reload' (you don't have to install and uninstall to see the changes now, just click 'Reload') and 'Open containing folder' which we think can be quite useful.


source: http://my.opera.com/desktopteam/blog/2010/11/06/snapshot

HTH smile

19. December 2010, 09:17:51

Mediin

Posts: 3

What is this Extension supposed to do? Probably just showing a popup, but i don't know for sure, since the downloaded example doesn't work either.

25. April 2011, 01:13:10

Opera Software

tagawa

Posts: 143

Mediin: Yes, it's just a very simple extension to demonstrate basic functionality, so it just opens a popup.

Proghead: Could you tell me what OS you're using please? I'm trying to reproduce the issue but in the meantime, using wget to download it should work:
wget http://dev.opera.com/articles/view/opera-extensions-hello-world/hello.oex

25. April 2011, 07:11:20

Tano80

Posts: 2

please give my message to opera developers that UCWEB IS FAR BETTER THAN PERA MINI now so try to advance Opera with keypad handling system. thanks

25. April 2011, 09:25:22

Opera Software

chrismills

Posts: 379

Originally posted by Tano80:

please give my message to opera developers that UCWEB IS FAR BETTER THAN PERA MINI now so try to advance Opera with keypad handling system. thanks



This is a slightly trollish comment - can you be a bit more exact with your feedback? What exactly is wrong with the keypad system? Feel free to message me on cmills@opera.com if you want to target feedback more directly.

thanks!
Chris Mills
Developer Relations Manager
Editor, dev.opera.com and labs.opera.com

4. May 2011, 09:23:31

idev007

Posts: 10

Awesome!
I just built my first OEX in less than five min!!!

12. October 2011, 08:16:52

IgorT75

Posts: 8

There is a mistype in config.xml file in this line:

<widget xmlns="http://www.w3.org/ns/widgets" id="http://www.example.org/helloworld">


It should be:
<widget xmlns="http://www.w3.org/ns/widgets" id="http://www.example.org/helloworld">

Without this fix it doesn't work on my side at least.
Took me few minutes to find this.

Shame to post "Hello world" examples not working!
However it is great step from Opera to introduce extensions.

Thanks.

13. October 2011, 09:00:04

Opera Software

chrismills

Posts: 379

Originally posted by IgorT75:

There is a mistype in config.xml file in this line:<widget xmlns="http://www.w3.org/ns/widgets" id="http://www.example.org/helloworld">It should be:<widget xmlns="http://www.w3.org/ns/widgets" id="http://www.example.org/helloworld">Without this fix it doesn't work on my side at least.Took me few minutes to find this.



At the risk of sounding stupid - I can't see any difference between these two lines. What is the mistake that we included? ;-)

oh, wait - now I see - there was an (un)unescaped &quot; in the code listing. Fixed now - sorry about that!

Appreciate you bringing it to my attention.
Chris Mills
Developer Relations Manager
Editor, dev.opera.com and labs.opera.com

29. October 2011, 06:43:16

pattyfoz

Posts: 1

So does it mean everything will be smooth now?

Forums » Dev.Opera » Archived Article Discussions