I have an app that loads a JavaScript library from a 3rd party vendor in my head tag on _Host.cshtml. Depending on the browser request, I need to swap out the src attribute and load a different library because the src link will change.
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>PictometryHost</title>
<base href="~/" />
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
<link href="css/site.css" rel="stylesheet" />
<!-- include the IPA JS Library from pictometry -->
<script type="text/javascript" src="http://pol.pictometry.com/ipa/v1/embed/host.php?apikey=someapikey"></script> <----This right here I need to change on the fly.
<script src="~/Pictometry.js"></script>
On my index.razor page, I have created a property IpaJsLibUrl that will load the proper src attribute link into.
I would like to just inject this property into the src attribute in the script tag if possible. But any way I can dynamically change this src attribute to what I want would be fabulous!