Skip to content

Commit

Permalink
fix(android): Remove path from allowedOriginRules (#7293)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile committed Mar 13, 2024
1 parent cbb6407 commit 9eb565c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion android/capacitor/src/main/java/com/getcapacitor/Bridge.java
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,12 @@ private void loadWebView() {
// Start the local web server
JSInjector injector = getJSInjector();
if (WebViewFeature.isFeatureSupported(WebViewFeature.DOCUMENT_START_SCRIPT)) {
WebViewCompat.addDocumentStartJavaScript(webView, injector.getScriptString(), Collections.singleton(appUrl));
String allowedOrigin = appUrl;
Uri appUri = Uri.parse(appUrl);
if (appUri.getPath() != null) {
allowedOrigin = appUri.toString().replace(appUri.getPath(), "");
}
WebViewCompat.addDocumentStartJavaScript(webView, injector.getScriptString(), Collections.singleton(allowedOrigin));
injector = null;
}
localServer = new WebViewLocalServer(context, this, injector, authorities, html5mode);
Expand Down

0 comments on commit 9eb565c

Please sign in to comment.