densen2014 / ZXingBlazor

Using ZXing Scan barcode/QR code in blazor
Apache License 2.0
93 stars 39 forks source link

Broken on sites that use a sub-url #16

Closed gaelj closed 1 year ago

gaelj commented 2 years ago

All my sites are hosted on the same server, each having its own sub-url.

Example:

Due to this I get 404s in production, because it's looking for resources at the root of the server. I guess all js lines similar to import '/_content/ZXingBlazor/lib/zxing/zxing.min.js'; should have the first / removed.

densen2014 commented 2 years ago

maybe change to import './_content/ZXingBlazor/lib/zxing/' will works for you?

if you can,run with source code and debug it. and PR it : )

yablos commented 1 year ago

This one worked for me on blazor server project - .net60: zxing.js //import './_content/ZXingBlazor/lib/zxing/zxing.min.js'; change to: import './zxing.min.js';

startup.cs: app.UseHttpsRedirection(); app.UseStaticFiles() <-- important one

densen2014 commented 1 year ago

This one worked for me on blazor server project - .net60: zxing.js //import './_content/ZXingBlazor/lib/zxing/zxing.min.js'; change to: import './zxing.min.js';

startup.cs: app.UseHttpsRedirection(); app.UseStaticFiles() <-- important one

Thanks for shared!