Sure, I added following in my Widget source
What I did is to keep a flag in appsettings.json ?
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*",
"CustomSettings": {
"IsDeploymentMode": "local"
}
}
Added in Index.cshtml view
string isLocal = @Configuration["CustomSettings:IsDeploymentMode"];
@section Scripts{
<script type="text/javascript">
var isLocal = '@isLocal';
</script>
}
and added these lines in my JavaScript plugin
let localPathUrl = new URL(appPath);
let enquiryPathUrl = localPathUrl.pathname.replace(isLocal !== "local" ? 'rental.asp' : 'rental.html', '');
window.location = enquiryPathUrl;
This work for both my local machine/project and for QA server.
I just need to change for Live Server
"IsDeploymentMode": "live"
Thank you everyone