开发者

Make a JavaScript Auto generator for visitors to my website

开发者 https://www.devze.com 2022-12-12 18:30 出处:网络
I have a website that stores quotes and users can add some quotes to their favorite list. I want to be able to let those users generate a JavaScript snippet to put in their blog or website and this Ja

I have a website that stores quotes and users can add some quotes to their favorite list. I want to be able to let those users generate a JavaScript snippet to put in their blog or website and this JavaScript will display their favorite quotes one by one every set period of time say 60 seconds.

I have been using Ruby on Rails which have a lot of the JavaScript 开发者_JS百科out of the box so I didn't learn any JavaScript library or such.

I was wondering if you know what's the easiest way to do this whether by using JavaScript library, using Rails plugin or by using some external plugin.

Thanks,

Tam


Since you probably anticipate your users to show their quotes on blogs, forums, web sites etc., you cannot count on the availability of JavaScript. I suggest adopting an iframe approach: have a page in your site expose content based on a query string, that can be shown in an iframe. Provide the code to the user to paste into his site's html.

You want a sample? Look no further than StackOverflow flair :).


You may consider just making the user's favorite quotes available as an RSS or atom feed. Then just find and use one of the many RSS reader widgets available.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号