Skip to content

Instantly share code, notes, and snippets.

@busterc
Created July 9, 2019 22:44
Show Gist options
  • Save busterc/523e080e5661d61e4940390043cb083a to your computer and use it in GitHub Desktop.
Save busterc/523e080e5661d61e4940390043cb083a to your computer and use it in GitHub Desktop.
[Cordova Live-Server] how to configure a Cordova App to render content from Live-Server #cordova

Cordova Live-Server

how to configure a Cordova App to render content from Live-Server

config.xml

Add elements: content and allow-navigation

<widget>
	<content src="http://127.0.0.1:8080" />
	<allow-navigation href="http://127.0.0.1:8080/*" />
</widget>

index.html

Update meta CSP to include: ws: wss: 'unsafe-inline' http://127.0.0.1:8080

<head>
	<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: ws: wss: 'unsafe-inline' http://127.0.0.1:8080 https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:;">
</head>

Live-Server

npx live-server --port=8080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment