Closed Fungusware closed 1 year ago
contact_content
? How did this happen? You should get the .js file from the root of the domain, such as:
https://localhost:7284/_content/DNTCaptcha.Blazor/scripts/dntCaptcha.js
and not concatenation of the different parts, such as your posted URL:
https://localhost:7284/contact_content/DNTCaptcha.Blazor/scripts/dntCaptcha.js
Here is a sample to show it in a subdomain with a routed page: https://vahidn.github.io/DNTCaptcha.Blazor/routed-login-page Also you can run it locally if you want.
So I have a Contact Form component that I use in both places. On the Index page it works, but not on the Contacts page.
I'm not constructing that URL _content/DNTCaptcha.Blazor/scripts/dntCaptcha.js That is what is being generated.
Does it do the same in Blazor Server ?
Yes. I updated that sample too. You can download it and test it locally.
Can I invite you to my Repo, see if you can see whats going on. I've tried it all.
Your sample worked ok,
Don't remove the base href from the _Host.cshtml
file:
<base href="~/"/>
The
You Sir, are amazing !
When I use DNTCaptcha on my index page (routed as /) everyting works as expected. However when I use it on a page with a route such as /contact I am getting the error below.
[2022-11-15T08:47:57.354Z] Error: Microsoft.JSInterop.JSException: Failed to fetch dynamically imported module: https://localhost:7284/contact_content/DNTCaptcha.Blazor/scripts/dntCaptcha.js TypeError: Failed to fetch dynamically imported module: https://localhost:7284/contact_content/DNTCaptcha.Blazor/scripts/dntCaptcha.js at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args) at DNTCaptcha.Blazor.DntInputCaptcha.LoadScriptsAsync() in F:\Prog\1400\DNTCaptcha.Blazor\src\DNTCaptcha.Blazor\Components\DntInputCaptcha.razor.cs:line 323 at DNTCaptcha.Blazor.DntInputCaptcha.OnAfterRenderAsync(Boolean firstRender) in F:\Prog\1400\DNTCaptcha.Blazor\src\DNTCaptcha.Blazor\Components\DntInputCaptcha.razor.cs:line 305 at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)