TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Creating widgets

2 点作者 amrithk大约 17 年前
Hi everyone, This might be a silly question but how are widges actually created/deployed?<p>I am interested in creating a tool that would allow people to create and embed a widgeton their webpage. The widget will basically collect responses from individuals and store them in our database. The widget will also show all responses that have already been entered in the database. You could say its something like the widgets created by PollDaddy.<p>I understand the HTML part necessary to display the widget. However, how do I get the dynamic part (mainly interacting with our database) working without making it too complicated for the widget user to embed.<p>Any suggestions will be helpful. Thanks!

1 comment

dpapathanasiou大约 17 年前
One simple way is to use javascript.<p>Have your users add a single &#60;script&#62; tag in their html page, which points to a javascript file on <i>your</i> server.<p>That javascript file on your server is just a single statement:<p><pre><code> document.write(" ... [ widget content goes here ] ... "); </code></pre> which gets executed every time someone visits your user's site.<p>Just generate the javascript file on your server as often as necessary (and, obviously, you can have multiple javascript files customized for each of your users).
评论 #173724 未加载