我的应用程序有时会打开弹出窗口拦截器,当用户运行应用程序时,chrome 在 url 框(右侧)中有一些标志,告诉用户弹出窗口已被阻止 ,在这种情况下,我给用户另外的新警告消息,例如“请注意该页面已被阻止,请启用它...”
我的问题是我何时以及在哪个学期需要再次进行此检查,假设用户允许新的应用程序页面
- if user close and open the browser does he need to enable this pop-up again ?
I know that if the user will run it in diffrent chrome versions (like canary or beta) he probably need to confirm this page again but my question in which cases the pop-up will show again to the same user(which confirm it before)
In which case after allowing the App to run the pop-up blocker will block it again?
顺便说一句,我看到在我的公司他们将异常(exception)添加到弹出窗口阻止程序 有了一些自动化的过程,它怎么可能?有代码可以做到吗?(奇怪...)
当我点击 setting search for pop -> privacy -> content settings -> manage exception 然后我看到了
最佳答案
- Do you know how its possible to the company to add this privacy settings ( i've addtional for my company entries domain pattern...), how this is possible?
Policies
可以设置,覆盖在 Settings
中设置的用户 Preferences
。
参见 Documentation for Administrators , 点击链接 Windows Quick Start , Mac Quick Start , 或 Linux Quick Start . 阅读Configuring Other Preferences , Policy Settings in Chrome
Should I use a Preference, or a Policy?
If you want to set some specific behavior that is accomplished by both a preference and a policy, and you're not sure which one you should use, simply answer: do you want users to be able to change this setting?
User cannot change policies at will, but they can change their preferences.
请注意,对 Preferences
文件的这些更改应该在 chrome 时进行,chrome 关闭时,即没有正在进行的进程实例以避免 SingletonLock
文件未被在 Default
目录中创建,当 chrome 再次启动时。
在浏览器配置文件中的 Preferences
文件中设置首选项,例如 $ gedit ~/.config/chromium/Default/Preferences
"popups":{"[*.]domain1.com,*":{"setting":2},"[*.]domain2.com,*":{"setting":1}}
其中 2
阻止弹出窗口,1
允许弹出窗口,另请参见 DefaultPopupsSetting
.
Settings
中Pop-up exceptions
的Behavior
右边的图标表示
This setting is enforced by your administrator.
策略可以应用于设备 Set Chrome policies for devices或用户 Set Chrome policies for users由管理员。
策略在不同平台的格式是
Example value:
Windows:
Software\Policies\Google\Chrome\PopupsAllowedForUrls\1 = "https://www.example.com" Software\Policies\Google\Chrome\PopupsAllowedForUrls\2 = "[*.]example.edu"
Android/Linux:
["https://www.example.com", "[*.]example.edu"]
Mac:
<array> <string>https://www.example.com</string> <string>[*.]example.edu</string> </array>
例如,要在 *nix 平台上为弹出窗口的设备创建强制策略,您可以在 /etc/chromium-browser/policies/managed/< 中创建一个
.json
文件
$ sudo touch /etc/chromium-browser/policies/managed/popup_policy.json
$ gksudo gedit /etc/chromium-browser/policies/managed/popup_policy.json
然后为 PopupsBlockedForUrls
、PopupsAllowedForUrls
设置弹出策略
{
"PopupsBlockedForUrls": ["[*.]example.com", "[*.]example1.com]"],
"PopupsAllowedForUrls": ["[*.]example2.com", "[*.]example3.com]"]
}
当 chrome 启动时,您可以通过导航到
来验证政策是否得到执行chrome://policy
应在何处列出策略;例如
Applies to Level Source Policy name Policy value Status
Machine Mandatory Platform PopupsBlockedForUrls [*.]example.com, [*.]example1.com] OK
政策列表模板示例可在 policy_templates.json 获得。 ,另见 Policy Templates .
关于javascript - chrome 弹出窗口阻止程序允许页面后何时重新检查,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40282861/