How to create an embedded widget?

My webapp uses both Rails and JS, and I would like users to be able to embed the images that they upload to any blog / site.

What I need to know from a development perspective so that I can create functionality that generates an embed link. It could be a link like YouTube, or a fragment of JS or something else.

I just want to get a high-level overview of what I need to do and how to act.

Thanks.

+8
javascript ruby-on-rails-3
source share
2 answers

I would try using iframe. I created a widget that used javascript, and I put it all in a single html file hosted on my website. Then I gave, for example, an iframe fragment, for example ...

<iframe src="http://mywesbite.com/myWidget.html"></iframe> 

A user can simply put an iframe fragment on his site and what a he!

+7
source share

I was a bit late for the party here, but I just wanted to add Jacob's answer.

You can easily allow the user to customize the built-in content (maybe choose a light in dark or dark light to more closely match the environment / design of the page) using the request parameters in iframe src:

 <iframe src="http://___.com/widget?theme=light&size=large"></iframe> 

Of course, you probably want to create a user interface so that the user can make these various changes ... you cannot expect the average user to do this manually :)

Vimeo UI for configuring embedded videos is very good if you need a better script.

+1
source share

All Articles