[英]How to embed 3rd party widgets on Blogger
As a webmaster, how can I allow Blogger users to embed my content on their blogs? 作为网站站长,我如何允许Blogger用户在我们的博客上嵌入我的内容?
I tried the following solution - simple button redirecting to: 我尝试了以下解决方案 - 简单的按钮重定向到:
https://www.blogger.com/blog-this.g?u=[ MY URL ]&t=[ MY WIDGET CODE ]
with tag inside [ MY WIDGET CODE ]
. 标签内有
[ MY WIDGET CODE ]
。
I encountered two problems: 我遇到了两个问题:
the <script>
tag seems to be erased automatically from proposed post content <script>
标签似乎会自动从建议的帖子内容中删除
even if user copies and pastes the script, it only works after publication - so user is unable to see how is it going to look like in the preview 即使用户复制并粘贴脚本,它也只能在发布后使用 - 因此用户无法看到它在预览中的外观
Thanks in advance for any tips :) 在此先感谢任何提示:)
Note: I know it is probably a security issue, but if blogger is able to post content with scripts then why isn't he able to preview them? 注意:我知道这可能是一个安全问题,但如果博客能够使用脚本发布内容,那么他为什么不能预览呢?
If your problem is that script tags are erased then you can make a js file and host it on google drive or any other servers you like and link this js to your blog template. 如果您的问题是脚本标签被删除,那么您可以制作一个js文件并将其托管在谷歌驱动器或您喜欢的任何其他服务器上,并将此js链接到您的博客模板。 I used this approach for third party plugins like codehighlighter and it works.
我使用这种方法为codehighlighter等第三方插件,它的工作原理。 You can see http://a2znotes.blogspot.com
你可以看到http://a2znotes.blogspot.com
I don't know Blogger but if I'm not mistaken they can add javascripts to their templates, then should be relatively easy to add content from other domains, add your script or just use jsonp . 我不知道Blogger,但如果我没有弄错,他们可以将javascripts添加到他们的模板中,然后应该相对容易地添加来自其他域的内容,添加脚本或只使用jsonp 。
sources: 来源:
edit 编辑
How to Add a Widget to Blogger 如何向Blogger添加小组件
see #5: Add a custom widget to Blogger using the HTML and JavaScript widget 请参阅#5:使用HTML和JavaScript小部件向Blogger添加自定义小部件
The HTML and JavaScript widget within Blogger is a blank widget that allows you to add or paste third-party functionality or other code to your blog.
Blogger中的HTML和JavaScript小部件是一个空白小部件,允许您向博客添加或粘贴第三方功能或其他代码。 The HTML and JavaScript widget can be found by clicking on "Add a Gadget" from the Blogger Layout screen
通过单击Blogger布局屏幕中的“添加小工具”,可以找到HTML和JavaScript小部件
May be widgets work on preview. 可能是小部件在预览上工作。
<object data=http://xyz.blogspot.com/atom.xml width=”600″ height=”400″>
<embed src=http://xyz.blogspot.com/atom.xml width=”600″ height=”400″> </embed>
Error: Embedded data could not be displayed.
</object>
This may help you. 这可能对你有所帮助。 Source: http://lowendmac.com/2006/embed-a-blogger-feed-in-your-web-page/
资料来源: http : //lowendmac.com/2006/embed-a-blogger-feed-in-your-web-page/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.