0

I want to use cobalt to launch local html page, So how can I launch local page by Cobalt 16 master.

Sunch as ./cobalt --url=xxxxxxx.

shilovk
  • 11,718
  • 17
  • 75
  • 74
Devin
  • 1
  • 2
  • What have you tried so far? You should have tried solving the problem on your own first before asking on Stackoverflow. To give you just a small hint, check https://en.wikipedia.org/wiki/File_URI_scheme – Capricorn Jun 14 '18 at 17:38

2 Answers2

0

Use the --web_file_path commandline argument to set the directory for the local content, in conjunction with --url to specify the start page.

Example: ./cobalt --web_file_path=/home/content_folder --url=file:///index.html

(Note the three /// is required)

This will load the page: /home/content_folder/index.html
Works on any non-gold build.

Henry Zhou
  • 31
  • 4
  • Thank you very much for your help. So how to set the web_file_path in the code and work on gold build. Thanks – Devin Jun 15 '18 at 01:18
0

Run a local web server and point Cobalt to it using --url=http://localhost:xxxx. This will work in all Cobalt configurations and will allow you to specify HTTP headers (for example, Content-Security-Policy) should you need them. Same-origin policy will work as expected as well, so you'll be able to access resources such as images and style sheets.

mmotorny
  • 320
  • 1
  • 7
  • We don't have a local web server, we only want to launch the local page.Before master16,we use js extension and specify the parameter kSbSystemPathSourceDirectory(/content/dir_source_root----System_get_path),so we can put our page in this dir, and use --url=file:///index.html to launch local url. But at master16, the parameter can't be used, so how can I specify the dir which save the page and images \ style sheets, and make the page can work on the gold version. Thank you very much. – Devin Jun 19 '18 at 01:21