Register  |  Login




Advertisement

Start Your Own Q&A Site

Create your own Q&A site easily, allowing you to quickly grow a new community around any subject matter or generate new organic traffic for your existing website.

Question

Status: Open Points: 250 Time: 13:54 - Mar 08, 2010  

jgivoni

How to write an embeddable widget using jQuery

I would like to write a widget that users can embed on any page.

The widget's functionality is irrelevant, but let's say that it will show a list of bands from my website.

I'm trying to figure out the perfect way to embed this widget, and here's some criteria:
- The code that should be embedded should be as small as possible
- The widget will need the jQuery library to be available. If it is not already loaded, it should load it, but leave no trace of it afterwards.
- The widget should not in any way disturb already running javascript on the page
- The widget should slow down page load as little as possible. It must not make the page hang until the complete widget has been loaded.
- The widget should only fetch its content once the complete page has loaded, as not to disturb the original user experience

The optimal would be a line like this:
<script type="text/javascript" src="myWidgetUrl"></script>

Which would fetch less than 1kb of code, which can be cached without need to reload if another page also contains the widget.

All this initial code needs to do is bind a function to the onload event, to be executed once the page has loaded.

I can write something that will work, but I would like if anybody's got any input, and maybe together we can figure out the perfect implementation and publish it as an example of how to write your own embeddable widget.

- Jakob

Answer Discussion
Tutorials

 

This question has not yet been answered.

Answer this Question

New User

Email:

Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address

Registered User

Username:

Password:

Forgot Your Password?

Tutorials cannot be submitted until the Answer Discussion is complete.

Submit answers in the Answer Discussion area

Ask a Question

Have a new question? Ask!

You have 100 characters to use



Top Experts

View More

Rank

Expert

Points

1.

nidhi

10279

2.

oracleofDelphi

6493

3.

rcastagna

5596

4.

LAGM

4848

5.

PeterNZ

3487

6.

gonzalo

2840

7.

Mason

2770

8.

jgivoni

2303

9.

xarcus

1820

10.

Anpanman

917

Become an Expert

Register today to share your knowledge with the community and be recognized and rewarded for your contributions.


Register Here




"Psst, Quomon is a great site. Pass it on."     Tell a Friend  |   Link To Us  |   Save to Delicious  |   Digg! Digg it



Language Options

English:

www.quomon.com

Español:

www.quomon.es