如何在完全隔离的Chrome实例中运行Rails应用程序? [英] How to run rails app in a completely isolated instances of chrome?

查看:79
本文介绍了如何在完全隔离的Chrome实例中运行Rails应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时客户端和服务器端的缓存,Cookie和其他复杂的因素可能会变得棘手,并且当它们出现时,有时在浏览器中打开应用程序并进行检查可能是一种快速了解情况的方法.

Sometimes client and server side caching, cookies, and other complicating factors can get tricky, and when they do, sometimes opening an app in the browser and inspecting can be a quick way to see what's going on.

但是,由于各种原因,有时最好在完全隔离的chrome实例(或其他浏览器)中打开应用程序,而无需更改当前的chrome实例(例如,您可能拥有的参考页面)打开,甚至加载了应用程序的其他选项卡-有时您只想在一个完全隔离的环境中打开您的应用程序,就像它完全是另一台计算机一样.

However, for various reasons, sometimes it would be nice to open the app in a completely isolated instance of chrome (or other browser), without any need to alter current chrome instance(s) (e.g. the reference pages you may have open, or even other tabs with your app loaded - sometimes you just want a completely isolated environment to open your app in, just as though it were another computer altogether).

如何实现?

  • 隐身模式-缺点是只能打开实例一次,因为多个隐身窗口将共享cookie/资产
  • 在docker中运行Chrome?(我还没有尝试过,这只是一个主意)
  • 我拥有atm的唯一肯定的方法是简单地将应用程序投入生产并在另一台计算机上进行查看/测试(这既不明智也不高效,因为我想在开发中进行测试,例如localhost)
  • 在另一种浏览器中打开应用是另一种可能,但是,假设我们要专门在chrome中进行测试

推荐答案

Chrome Firefox 支持使用不会互相影响,可重复使用(与隐身模式不同)甚至可以具有完全不同的扩展生态系统的多个配置文件.

Chrome and Firefox supports using multiple profiles that won't affect each other, reusable (unlike incognito) and can even have entirely different extension ecosystem.

通过创建和使用多个配置文件,您可以进行开发-创建扩展,修改浏览器或测试浏览器-同时仍可以使用Google Chrome浏览器作为默认浏览器.

By creating and using multiple profiles, you can do development — creating extensions, modifying the browser, or testing the browser — while still being able to use Google Chrome as your default browser.

操作方法:

来自Chromium文档:

How to do it:

From Chromium docs:

如何创建和使用配置文件的详细信息因平台而异,但这是基本过程:

The details of how to create and use a profile vary by platform, but here's the basic process:

  • 创建一个文件夹来保存新配置文件的数据.
  • 使用--user-data-dir命令行参数来指定配置文件的位置,从而创建启动浏览器的快捷方式或别名.
  • 无论何时启动浏览器,请使用与配置文件关联的快捷方式或别名.如果配置文件文件夹为空,则浏览器会为其创建初始数据.

换句话说,只需在某处创建一个空目录,然后运行该目录以打开与当前任何一个完全独立的chrome新实例:

In other words, simply create an empty directory somewhere and run this to open a new instance of chrome that's completely separate from any current one:

open -n -a "Google Chrome" --args --user-data-dir=$(mktemp -d)

相关:

这篇关于如何在完全隔离的Chrome实例中运行Rails应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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