Closed tjrodrigues12 closed 1 year ago
Hi Working on an update Thank you for mentioning the issue
Please update the package to version 2.0.0 and put the
<script src="_content/GoogleCaptchaComponent/Scripts/ScriptLoader.js"></script>
in _Layout.cshtml
file before
<script src="_framework/blazor.server.js"></script>
DON'T put any script code in _Host.cshtml
file
When a call the script on _host.cshtm Blazor .NET 6 the following problem happens:
2022-08-18T16:51:01.222Z] Error: Microsoft.JSInterop.JSException: Could not find 'loadScript' ('loadScript' was undefined). Error: Could not find 'loadScript' ('loadScript' was undefined). at http://localhost:5251/_framework/blazor.server.js:1:497 at Array.forEach ()
at i.findFunction (http://localhost:5251/_framework/blazor.server.js:1:465)
at E (http://localhost:5251/_framework/blazor.server.js:1:2606)
at http://localhost:5251/_framework/blazor.server.js:1:3494
at new Promise ()
at kt.beginInvokeJSFromDotNet (http://localhost:5251/_framework/blazor.server.js:1:3475)
at http://localhost:5251/_framework/blazor.server.js:1:72001
at Array.forEach ()
at kt._invokeClientMethod (http://localhost:5251/_framework/blazor.server.js:1:71987)
at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)
at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args)
at GoogleCaptchaComponent.Components.GoogleRecaptcha.OnAfterRenderAsync(Boolean firstRender)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
It doesn't seem to be finding the script in the lifecycle, what could I do to fix it?