简体   繁体   English

如何在Blogger上嵌入第三方小部件

[英]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 编辑

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.

相关问题 如何在 Blogger 3rd 方主题中强制加载 Disqus 评论 - How to force load Disqus Comments in a Blogger 3rd party Theme 集成Angularjs指令和第三方小部件 - Integrating Angularjs directives and 3rd party widgets 针对第三方JavaScript小部件的分析 - Analytics for 3rd party JavaScript widgets 如何在htaccess文件中为第三方API和小部件利用缓存控制? - How can I leverage cache control for 3rd party APIs and widgets in my htaccess file? 如果我的第三方js脚本嵌入到网站上,如何自动保存每篇新文章的标题 - How to automatically save the headline for every new article provided my 3rd party js script is embed on a website 试图嵌入使用的第三方Javascript <?js= value ?> ,我怎么能阻止PHP解析“ - Trying to embed 3rd party Javascript that uses <?js= value ?>, how can i stop php from parsing the “<?” 如何正确地将第三方供应商的脚本标签嵌入Rails视图 - How to properly embed script tags from 3rd party vendor into into rails view iframe或JS将Rails嵌入第三方网站? - iframe or JS to embed Rails in 3rd party sites? 如何在requirejs中包含第三方脚本 - How to include 3rd party scripts with requirejs 如何在浏览器中访问第三方cookie? - How to access 3rd Party cookies in the Browser?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM