How to create a web widget for my website users to insert on their blog?
For my wishlist site, I would like to propose widgets to my users in order to publish their wishlist on their blog or personal website. The idea is to propose a few lines of code to my users that they only need to copy/paste to insert the widget displaying their wishlist.
What is the best way to create/develop a widget ?
- I have a RSS feed for each wishlist
- Since the code need to be dynamic, I prefer not to use service like WidgetBox
- F开发者_如何学运维lash ? iFrame ?
- Possibility to use jQuery
Thanks for your input...
Definitely not flash [throws up]
What about using JavaScript? I am reminded of the Twitter Lists Widget that uses a bit of JavaScript to return the data and paint the HTML on the screen.
This is how Twitter does it:
<script src="http://widgets.twimg.com/j/2/widget.js"></script>
<script>
new TWTR.Widget({
version: 2,
type: 'list',
rpp: 30,
interval: 6000,
title: 'Everything we do at',
subject: 'the twoffice',
width: 250,
height: 300,
theme: {
shell: {
background: '#ff96e7',
color: '#ffffff'
},
tweets: {
background: '#ffffff',
color: '#444444',
links: '#b740c2'
}
},
features: {
scrollbar: true,
loop: false,
live: true,
hashtags: true,
timestamp: true,
avatars: true,
behavior: 'all'
}
}).render().setList('ilmv', 'web-geeks').start();
</script>
Obviously you may not need to use as many options, but a username field would certainly be helpful. It would be very easy to generate your users code, and you might even be able to make use of your RSS feed for this.
No reason not to use Flash, depending on what exactly you want to do. There are more or less universally accepted embed codes (see youtube's, for instance) that will allow a user to copy-and-paste the widget into their own website, pulling content from your server. You will retain control over the content of the widget, too, so if you want to re-style it or make a copy change then you can do that on your end and be confident that no matter where it's embedded the change will take effect.
AS3 is very powerful and allows you to do basically anything you want. The one trade-off here is that Flash doesn't display on iPhones as of right now. That will probably change in the future, but probably not in the immediate future.
If you're using RSS to manage the data you're in luck because Flash's native E4X parser will let you work with that data easily and use it as a model for whatever you want to build. If I were doing something like this I'd use Flash without a second thought, but in fairness I am a professional AS3 developer.
精彩评论