如何在本地测试Chromium / Chrome扩展的内联安装? [英] How to test inline installation of Chromium/Chrome extensions locally?

查看:83
本文介绍了如何在本地测试Chromium / Chrome扩展的内联安装?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图根据本文档测试Chrome网上应用店的内嵌安装功能( https://developers.google.com/chrome/web-store/docs/inline_installation )。
我正在开发本地测试,并且不能轻松地并经常推动我的更改。



如何在本地测试内联安装,因为内联安装取决于您的站点正在通过网站管理员工具进行验证?

代码

  $ c $> $($ ch $ .b) 

$ / code>

返回:

 安装只能由Chrome网上应用店商品的已验证网站启动



解决方案

/ div>

通过 Google的使用内嵌安装指南:请注意,如果您验证所有权对于某个域(例如, http://example.com ),您可以从任何子域或页面启动内联安装。



所以,如果你拥有一个域名,你可以验证它,然后模拟你的本地机器是你已验证域名的子域名。



例如,如果您向Google验证域example.com,则可以在您的主机文件中包含以下内容:

  127.0.0.1 local.example.com 

然后,您可以通过 http://local.example.com 访问您的本地服务器(可能需要您的本地网络服务器上的某些配置)。如果您将Chrome Webstore中的商品与example.com相关联,则可以从本地页面开始内联安装。


I am trying to test the inline installation feature of the Chrome Webstore as per this document (https://developers.google.com/chrome/web-store/docs/inline_installation). I am developing this locally to test and cannot easily and often push my changes live.

How do I test inline installation locally since inline installation depends on your site being verified in Webmaster Tools?

Code

if (!chrome.app.isInstalled) {
    chrome.webstore.install(undefined, undefined, function(err) {
        console.log(err);
    });
}

This returns:

Installs can only be initiated by the Chrome Web Store item's verified site 

Obviously localhost is not a verified site.

Any help is appreciated.

解决方案

From Google's Using Inline Installation guide: "Note that if you verify ownership for a domain (for example, http://example.com) you can initiate inline installation from any subdomain or page".

So, if you do own a domain, you can verify it and then simulate that your local machine is a subdomain of your verified domain.

For instance, if you verify with Google the domain example.com, you can include the following in your hosts file:

127.0.0.1 local.example.com

Then you can access your local server via http://local.example.com (some configuration on your local webserver may be needed). If you associate your item in the Chrome Webstore with example.com, you'll be able to start an inline installation from your local page.

这篇关于如何在本地测试Chromium / Chrome扩展的内联安装?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆