Skip to content

Commit 18c251c

Browse files
author
Capacitor+ Bot
committed
chore: sync upstream PR ionic-team#7781 from @cpojer
2 parents 4c7c126 + 7f8fdc8 commit 18c251c

File tree

1 file changed

+5
-2
lines changed
  • android/capacitor/src/main/java/com/getcapacitor

1 file changed

+5
-2
lines changed

android/capacitor/src/main/java/com/getcapacitor/Bridge.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,12 @@ private void loadWebView() {
264264
// Start the local web server
265265
JSInjector injector = getJSInjector();
266266
if (WebViewFeature.isFeatureSupported(WebViewFeature.DOCUMENT_START_SCRIPT)) {
267-
String allowedOrigin = Uri.parse(appUrl).buildUpon().path(null).fragment(null).clearQuery().build().toString();
267+
Set<String> allowedOrigins = new HashSet<>(Arrays.asList(
268+
Uri.parse(appUrl).buildUpon().path(null).fragment(null).clearQuery().build().toString(),
269+
"https://localhost"
270+
));
268271
try {
269-
WebViewCompat.addDocumentStartJavaScript(webView, injector.getScriptString(), Collections.singleton(allowedOrigin));
272+
WebViewCompat.addDocumentStartJavaScript(webView, injector.getScriptString(), allowedOrigins);
270273
injector = null;
271274
} catch (IllegalArgumentException ex) {
272275
Logger.warn("Invalid url, using fallback");

0 commit comments

Comments
 (0)