playframework - Play framework external Javascript URL syntax -
how use external javascript files in play framework?
i used syntax:
<script src="https://www.gstatic.com/charts/loader.js" type="text/javascript"></script>
i put in <head>
section of main.scala.html
.
https://www.gstatic.com/charts/loader.js
correct link, doesn't load , status of package (blocked:csp)
:
headers:
local javascript files work fine, example:
<script src="@routes.assets.versioned("javascripts/hello.js")" type="text/javascript"></script>
csp stands content security policy (see more):
corresponding header defines sources components allowed loaded. usually, default settings default-src: 'self'
. means own host allowed source scripts, css, images, etc. in case localhost:9999
, local javascript file passed. need add gstatic.com
allowed script-src
.
thus, configuration needs done in application.conf
-file:
play.filters.headers.contentsecuritypolicy = "default-src: 'self'; script-src: 'self' gstatic.com"
for further information, please visit official documentation.
Comments
Post a Comment