ຄູ່ມື Webapp¶
ວິທີທີ່ webapp ເຂົ້າກັບ shell¶
Web app ຈະສະແດງຜົນໃນ webview ພາຍໃນ webapp-container ທີ່ລັນເປັນແອັບ Ubuntu ໃນ Ubuntu/Unity shell.
ເບິ່ງລາຍລະອຽດເພີ່ມເຕີມ:
ໃນລະດັບໃນສຸດ, ຈະມີເວັບໄຊທ໌ທີ່ນັກພັດທະນາລະບຸດ້ວຍ URL. ເວັບໄຊທ໌ຈະຖືກປະມວນຜົນ ແລະ ລັນໃນ webview ທີ່ອີງໃສ່ Qt WebEngine. webview ນີ້ຖືກສະໜອງໃຫ້ໂດຍ Morph browser ແລະ ຈັດການສິ່ງຕ່າງໆໂດຍອັດຕະໂນມັດ ເຊັ່ນ: ກ່ອງໂຕ້ຕອບໄຟລ໌, ການດາວໂຫຼດ, ການອະນຸຍາດ ແລະ ອື່ນໆ.
ການເປີດໃຊ້ງານ¶
You can launch a webapp from the terminal with::
webapp-container URL
For example::
webapp-container https://www.ubuntu.com
ຮູບແບບງ່າຍໆນີ້ສາມາດໃຊ້ໄດ້, ແຕ່ເກືອບທຸກ webapp ຈະໃຊ້ຟີເຈີອື່ນໆນຳ ເຊັ່ນການຈຳກັດ URL ດ້ວຍຮູບແບບ URL ຕາມທີ່ຈະອະທິບາຍລຸ່ມນີ້.
ສ່ວນຕິດຕໍ່ຜູ້ໃຊ້ (User interface)¶
ໂດຍທົ່ວໄປແລ້ວ Webapp ຈະສະແດງເຕັມໜ້າຈໍແອັບ ໂດຍບໍ່ຈຳເປັນຕ້ອງມີການຄວບຄຸມ UI ຄືກັບໃນບຣາວເຊີມາດຕະຖານ.
ໃນບາງກໍລະນີ, ການມີຕົວຄວບຄຸມການນຳທາງກໍ່ມີຄວາມຈຳເປັນ ເຊັ່ນ ປຸ່ມກັບຄືນ ແລະ ໄປໜ້າ ຫຼື ແຖບທີ່ຢູ່. ສິ່ງເຫຼົ່ານີ້ສາມາດເປີດໃຊ້ໄດ້ດ້ວຍ command line arguments:
--enable-back-forwardເປີດການສະແດງປຸ່ມກັບຄືນ ແລະ ໄປໜ້າໃນແຖບເຄື່ອງມື (ຢູ່ລຸ່ມສຸດຂອງໜ້າຕ່າງ webapp)
--enable-addressbarເປີດການສະແດງແຖບທີ່ຢູ່ (ຢູ່ລຸ່ມສຸດຂອງໜ້າຕ່າງ webapp)
ຮູບແບບ URL¶
ຜູ້ສ້າງ Webapp ມັກຈະຕ້ອງການຈຳກັດການທ່ອງເວັບໃຫ້ຢູ່ໃນເວັບໄຊທ໌ເປົ້າໝາຍເທົ່ານັ້ນ. ໝາຍຄວາມວ່ານັກພັດທະນາຕ້ອງການຄວບຄຸມ URL ທີ່ຈະໃຫ້ເປີດໃນ webapp (URL ອື່ນໆຈະຖືກເປີດໃນບຣາວເຊີແທນ). ສິ່ງນີ້ເຮັດໄດ້ໂດຍການໃຊ້ຮູບແບບ URL.
ແນວໃດກໍ່ຕາມ, web app ຫຼາຍອັນອາດມີໜ້າເວັບທີ່ຢູ່ຫຼາຍໄຊທ໌ ຫຼື ໃຊ້ຊັບພະຍາກອນຈາກພາຍນອກ.
ທັງການຈຳກັດ ແລະ ການເຂົ້າເຖິງ URL ພາຍນອກທີ່ລະບຸ ແມ່ນເຮັດໄດ້ຜ່ານຮູບແບບ URL ທີ່ສົ່ງໃຫ້ໃນເວລາເປີດແອັບ.
ບໍ່ມີການຈຳກັດໂດຍຄ່າເລີ່ມຕົ້ນ¶
By default, there is no URL containment. Suppose you launch a webapp without any patters and only a starting URL like this::
webapp-container https://www.ubuntu.com
ຜູ້ໃຊ້ສາມາດທ່ອງໄປຫາ URL ໃດກໍ່ໄດ້ຢ່າງບໍ່ຈຳກັດ. ຕົວຢ່າງ: ຖ້າພວກເຂົາຄລິກປຸ່ມ Developer ຢູ່ດ້ານເທິງ, ພວກເຂົາຈະໄປທີ່ developer.ubuntu.com ແລະ ມັນຈະສະແດງຜົນພາຍໃນ webapp ເລີຍ.
ຄຳແນະນຳ: ທ່ານສາມາດເບິ່ງ URL ຂອງໜ້າປະຈຸບັນໄດ້ໂດຍການເປີດໃຊ້ແຖບທີ່ຢູ່ດ້ວຍ --enable-addressbar.
ການຈຳກັດໃຫ້ຢູ່ພາຍໃນເວັບໄຊທ໌ແບບງ່າຍດາຍ¶
One often wants to contain users to the site itself. That is, if the website is www.ubuntu.com, it may be useful to contain webapp users only to subpages of www.ubuntu.com. This is done by adding a wildcard URL pattern to the launch command, as follows::
webapp-container --webappUrlPatterns=https://www.ubuntu.com/* https://www.ubuntu.com
--webappUrlPatterns=ບົ່ງບອກວ່າຮູບແບບ URL ແມ່ນຢູ່ຖັດໄປhttps://www.ubuntu.com/* ຄືຮູບແບບ URL. ເຄື່ອງໝາຍດາວ (*) ຄື wildcard ທີ່ໃຊ້ແທນຕົວອັກສອນໃດໆໃນ URL
With this launch command and URL pattern, the user can navigate to and open in the webapp any URL that starts with https://www.ubuntu.com/. For example, they can click on the Phone button (https://www.ubuntu.com/phone) in the banner and it opens in the webapp, or the Tablet button (https://www.ubuntu.com/tablet). But, clicking Developer opens the corresponding URL in the browser.
ຄຳແນະນຳ: ໃຫ້ແນ່ໃຈວ່າໄດ້ລະບຸໂປຣໂຕຄໍ (protocol) ໃນ URL ເລີ່ມຕົ້ນ ເຊັ່ນ ໃຊ້ https://www.ubuntu.com ແທນ www.ubuntu.com ເພື່ອຄວາມຊັດເຈນ ແລະ ຄວາມປອດໄພ.
ຮູບແບບ wildcard ທີ່ຊັບຊ້ອນກວ່າ¶
You might want to limit access to only some subpages of your site from within the webapp. This is easy with wildcard patterns. (Links to other subpages are opened in the browser.) For example, the following allows access to www.ubuntu.com/desktop/features and www.ubuntu.com/phone/features while not allowing access to www.ubuntu.com/desktop or www.ubuntu.com/phone:
webapp-container --webappUrlPatterns=https://www.ubuntu.com/*/features https://www.ubuntu.com
ຫຼາຍຮູບແບບ¶
You can use multiple patterns by separating them with a comma. For example, the following allows access only to www.ubuntu.com/desktop/features and www.ubuntu.com/phone/features::
webapp-container --webappUrlPatterns=https://www.ubuntu.com/desktop/features,https://www.ubuntu.com/phone/features https://www.ubuntu.com
ຄຳແນະນຳ: ການໃຊ້ຫຼາຍຮູບແບບມັກຈະມີຄວາມຈຳເປັນເພື່ອໃຫ້ໄດ້ການຈຳກັດຕາມທີ່ຕ້ອງການ.
ການເພີ່ມ subdomain ສະເພາະ¶
Many URLs have one or more subdomains. (For example, in the following, "developer" is the subdomain: developer.ubuntu.com.) You can allow access to a single subdomain (and all of its subpages) with a pattern like this::
--webappUrlPatterns=https://developer.ubuntu.com/*
However, one usually wants the user to be able to navigate back to the starting URL (and its subpages). So, if the starting URL is https://www.ubuntu.com, a second pattern is needed::
--webappUrlPatterns=https://developer.ubuntu.com/*,https://www.ubuntu.com/*
Putting these together, here’s an example that starts on https://www.ubuntu.com and allows navigation to https://developer.ubuntu.com and subpages and back to https://www.ubuntu.com and subpages::
webapp-container --webappUrlPatterns=https://developer.ubuntu.com/*,https://www.ubuntu.com/* https://www.ubuntu.com
ການເພີ່ມ subdomain ດ້ວຍ wildcard¶
Some URLs have multiple subdomains. For example, www.ubuntu.com has design.ubuntu.com, developer.ubuntu.com and more. You can add access to all subdomains with a wildcard in the subdomain position::
webapp-container --webappUrlPatterns=https://*.ubuntu.com/* https://www.ubuntu.com
Note: An asterisk in the subdomain position matches any valid single subdomain. This single pattern is sufficient to enable browsing to any subdomain and subpages, including back to the starting URL (https://www.ubuntu.com) and its subpages.
ການເພີ່ມ http¶
Sometimes a site uses http for some of its URLs. In general this is unsafe and should be avoided, but here is an example that allows access to www.launchpad.net on both https and http inside the webapp (and all subpages due to the wildcard)::
webapp-container --webappUrlPatterns=https?://www.launchpad.net/* https://www.launchpad.net
ໝາຍເຫດ: ເຄື່ອງໝາຍຖາມໃນ https? ໝາຍຄວາມວ່າຕົວ 's' ເປັນຕົວເລືອກ (ຈະມີຫຼືບໍ່ມີກໍ່ໄດ້).
Command line arguments¶
webapp-container ຮອງຮັບຫຼາຍຕົວເລືອກເພື່ອປັບແຕ່ງການລັນເວັບແອັບພລິເຄຊັນຕ່າງໆ.
See all help with::
webapp-container --help
Note: Only the following options apply to converged Ubuntu.:
--fullscreen Display full screen
--inspector[=PORT] Run a remote inspector on a specified port or 9221 as the default port
--app-id=APP_ID Run the application with a specific APP_ID
--name=NAME Display name of the webapp, shown in the splash screen
--icon=PATH Icon to be shown in the splash screen. PATH can be an absolute or path relative to CWD
--webappUrlPatterns=URL_PATTERNS List of comma-separated url patterns (wildcard based) that the webapp is allowed to navigate to
--accountProvider=PROVIDER_NAME Online account provider for the application if the application is to reuse a local account.
--accountSwitcher Enable switching between different Online Accounts identities
--store-session-cookies Store session cookies on disk
--enable-media-hub-audio Enable media-hub for audio playback
--user-agent-string=USER_AGENT Overrides the default User Agent with the provided one.
Chrome options (if none specified, no chrome is shown by default)::
--enable-back-forward Enable the display of the back and forward buttons (implies --enable-addressbar)
--enable-addressbar Enable the display of a minimal chrome (favicon and title)
ໝາຍເຫດ: ຕົວເລືອກອື່ນໆແມ່ນສຳລັບ desktop webapps ແລະ ບໍ່ແນະນຳໃຫ້ໃຊ້ແລ້ວ.
ການທັບຊ້ອນ User-Agent string¶
ບາງເວັບໄຊທ໌ກວດສອບ User-Agent string ເພື່ອປັບປ່ຽນການສະແດງຜົນ. ບາງຄັ້ງມັນຈຳເປັນຕ້ອງປ່ຽນຄ່ານີ້ຈາກ webapp container.
To change the string from the command line, use the following option::
--user-agent-string='<string>' Replaces the default user-agent string by the string specified as a parameter
ການແຍກຂໍ້ມູນບຣາວເຊີ¶
ຂໍ້ມູນຂອງ webapp ຈະຖືກແຍກອອກຈາກບຣາວເຊີອື່ນ. webapp ຈະບໍ່ສາມາດເຂົ້າເຖິງປະຫວັດ ຫຼື ຄຸກກີ້ຂອງບຣາວເຊີອື່ນ ແລະ ບຣາວເຊີອື່ນກໍ່ບໍ່ສາມາດເຂົ້າເຖິງຂໍ້ມູນຂອງ webapp ໄດ້ເຊັ່ນກັນ.
ການຈັດເກັບຂໍ້ມູນ¶
ຮອງຮັບການເກັບຂໍ້ມູນແບບ: Local/Session Storage, IndexedDB ແລະ WebSQL (ທີ່ເລີກໃຊ້ແລ້ວ). ແຕ່ບໍ່ຮອງຮັບ FileSystem API ເພາະແອັບບໍ່ສາມາດເຂົ້າເຖິງລະບົບໄຟລ໌ໄດ້ໂດຍກົງ.