I wanted to pass dynamic value to src attribute of javascript, I tried couple of options but it didn't work. I am using plain javascript, not jquery.
These are the ways I tried; 1.
<script>
var script = document.createElement('script');
script.src ="some url here";
script.type="text/javascript";
document.head.appendChild(script);
</script>
Error message: Cross-Origin Read Blocking (CORB) blocked cross-origin response https://same url/ with MIME type text/html. See https://www.chromestatus.com/feature/5629709824032768 for more details.
Option 2:
<script>
var fileName = "<%=request.getAttribute("someurl here")%>";
document.write("<script type=\"text/javascript\" src=\"" + fileName + "\"><\/script>");
</script>
Error message: A parser-blocking, cross site (i.e. different eTLD+1) script, https://same url/, is invoked via document.write. The network request for this script MAY be blocked by the browser in this or a future page load due to poor network connectivity. If blocked in this page load, it will be confirmed in a subsequent console message. See https://www.chromestatus.com/feature/5718547946799104 for more details.