How to disable tabbed browsing, toolbar and address bar in Chrome

11,172 views
Skip to first unread message

Sandeep Veldi

unread,
May 17, 2013, 6:06:29 PM5/17/13
to chromium...@chromium.org
Hi All,
I've an thin client Enterprise application which needs to be packaged with the latest version of chrome. I'm trying to find if there's a way to disable tabbed browsing, toolbar and address bar in Chrome. So that, users will not be able to launch any other pages other than the application that I'm trying to deploy.

Thanks in advance!
Sandeep

Rouslan Solomakhin

unread,
May 17, 2013, 7:15:34 PM5/17/13
to sandee...@gmail.com, Chromium-discuss
You need to build a packaged app: http://developer.chrome.com/apps/about_apps.html



--
--
Chromium Discussion mailing list: chromium...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss
 
 
 

Sandeep Veldi

unread,
May 20, 2013, 1:39:43 AM5/20/13
to chromium...@chromium.org, sandee...@gmail.com
Rouslan,
Thanks for your response. I've gone through all the API available for packaged Apps including the experimental ones. But there's nothing that tells me how to launch an URL in the packaged app, how to create a desktop icon for the packaged app etc. Can you please help.

Rouslan Solomakhin

unread,
May 20, 2013, 12:02:13 PM5/20/13
to sandee...@gmail.com, Chromium-discuss
I haven't built a packaged app myself, but I hope that someone else on the list has the answers for you. As for launching a URL, can you simply load a URL in an <iframe src="http://myurl.com"></iframe>?

James Mortensen

unread,
May 20, 2013, 12:06:06 PM5/20/13
to sandeepveldi, chromium...@chromium.org
You need a <webview>. See http://developer.chrome.com/dev/apps/webview_tag.html

Also, to launch a local HTML window in your app which contains the webview, see:  http://developer.chrome.com/dev/apps/app.window.html

For examples and to get started, see the Chrome Samples that Google put together: http://developer.chrome.com/dev/apps/app.window.html#samples
--
James Mortensen
Project Manager, VoiceCurve, Inc.
866-707-4590
james.m...@voicecurve.com

Sandeep Veldi

unread,
May 20, 2013, 12:49:47 PM5/20/13
to chromium...@chromium.org
Thank you James. I'm able to resolve the webpage launch issue using webview. Now I'm facing another issue where the popups from the webpage are not showing up. Any idea on how to resolve that?

Sandeep Veldi

unread,
Oct 9, 2013, 10:28:50 AM10/9/13
to chromium...@chromium.org
For those of you who are looking for a solution to this, here's what I've done.

a) To disable address bar and to launch a specific website (web application URL), I've used chrome's "--app=<WEB_PAGE_URL>". This will launch the URL in a panel window which doesn't have address or menu bar. Here's the "Target" value and the "start in" value that I've setup to launch google.com in app mode.

Target: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --app=http://google.com
Start in: "C:\Program Files (x86)\Google\Chrome\Application"

Note: The "Chrome\Application" path will change based on the OS bit version. The example above refers to a 64 bit windows machine.

You just have to create a desktop or start menu shortcut, set the icon to whatever you need and setup the "Target" & "Start in" as mentioned above.

b) To disable creation of new tabs and windows, I've created a tiny "chrome extension" that does that. The approach that I followed is as follows:
  1. In the chrome extension, include the "tabs" permission in the manifest.
  2. In the javascript associated with the extension, I've used the "chrome windows" API.
  3. Whenever a new window or tab tries to get created (I think oncreate event or something like that), I've issued the "remove" window function as long as the Window type is not a "panel" or "popup".
  4. The tricky part is to install and enable this extension automatically. This will not happen by default because the user must grant the permissions for the extension to start accessing the "tabs" information.
  5. To go around this problem, I've done the following steps:
  6. Enable developer mode in chrome's extension settings page, install the extension that you have created, that will install the extension and store the files in an exploded format (originally the way you built it where there's a manifest and a background.js).
  7. Now goto the "Default" chrome profile folder. On 64 bit Windows machine, it looks like "C:\Users\<USERNAME>\AppData\Local\Google\Chrome\User Data\Default". You'll find the "Preferences" file. This is where all the chrome profile specific preferences are stored.
  8. Find your extension ID (GUID) from the chrome extensions page, search for that extension ID in the "Preferences" file that you just opened.
  9. Copy and store the extension related information that you find in the "Preferences" file. Here's a sample of how the extension settings content.
  10. "apdfllckaahabafndbhieahigkjlhalf": {
                "ack_external": true,
                "active_permissions": {
                   "api": [ "background", "clipboardRead", "clipboardWrite", "notifications", "unlimitedStorage" ]
                },
                "app_launcher_ordinal": "zv",
                "creation_flags": 137,
                "from_bookmark": false,
                "from_webstore": true,
                "granted_permissions": {
                   "api": [ "background", "clipboardRead", "clipboardWrite", "notifications", "unlimitedStorage" ]
                },
                "has_declarative_rules": false,
                "install_time": "13023553574245171",
                "lastpingday": "13025775600329930",
                "location": 1,
                "manifest": {
                   "app": {
                      "launch": {
                         "web_url": "https://drive.google.com/?usp=chrome_app"
                      },
                      "urls": [ "http://docs.google.com/", "http://drive.google.com/", "https://docs.google.com/", "https://drive.google.com/" ]
                   },
                   "background": {
                      "allow_js_access": false
                   },
                   "current_locale": "en_US",
                   "default_locale": "en_US",
                   "description": "Google Drive: create, share and keep all your stuff in one place.",
                   "icons": {
                      "128": "128.png"
                   },
                   "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDIl5KlKwL2TSkntkpY3naLLz5jsN0YwjhZyObcTOK6Nda4Ie21KRqZau9lx5SHcLh7pE2/S9OiArb+na2dn7YK5EvH+aRXS1ec3uxVlBhqLdnleVgwgwlg5fH95I52IeHcoeK6pR4hW/Nv39GNlI/Uqk6O6GBCCsAxYrdxww9BiQIDAQAB",
                   "manifest_version": 2,
                   "name": "Google Drive",
                   "offline_enabled": true,
                   "options_page": "https://drive.google.com/settings",
                   "permissions": [ "background", "clipboardRead", "clipboardWrite", "notifications", "unlimitedStorage" ],
                   "update_url": "http://clients2.google.com/service/update2/crx",
                   "version": "6.3"
                },
                "page_ordinal": "n",
                "path": "apdfllckaahabafndbhieahigkjlhalf\\6.3_0",
                "state": 1,
                "was_installed_by_default": true
             },

  11. This content will help you to automatically enable the extension by default on the user's machine.
  12. Once  you install chrome on the user's machine, chrome will create a master_preferences file in the same folder as the chrome.exe.
  13. Only when the user first launches chrome, the "Default" profile folder gets created.
  14. So, once installed on the user's machine, you have to simulate chrome's first run by running it in background, so that the users do not notice that.
  15. You have to probably write a VB script or something similar to run a bunch of windows commands - run chrome in background, wait for atleast 5 mins, kill chrome running in background, by this time it should created the "Default" profile folder, now insert the extension settings information that you have saved earlier immediately beneath the first time '"settings": {' occurs in the "Preferences" file.
  16. Now the next time user launches chrome, your extension is automatically enabled without user intervention.
  17. Basically copying the contents of the extension settings, will insert values for "granted_permissions" which will automatically enable the extension to have permissions over "tabs" instead of user manually confirming the permissions.

I know this is a little complex procedure. But, that's what I ended up with due to various facts such as the Group policy settings for chrome which do not work the way they are supposed to. For example: When I tried to block all the URLs except for the one for my Web Application using a combination of URLBlackList and URLWhiteList policy settings, it blocked my extension as well. May be because starting with chrome v29.x, chromium dev team has changed the way the extensions are handled.

Thanks,

Sandeep Veldi

Reply all
Reply to author
Forward
0 new messages