Skip to content

Support data URLs in Android with preventDeeplink enabled#444

Draft
Copilot wants to merge 8 commits intomainfrom
copilot/add-base64-html-url-support
Draft

Support data URLs in Android with preventDeeplink enabled#444
Copilot wants to merge 8 commits intomainfrom
copilot/add-base64-html-url-support

Conversation

Copy link
Contributor

Copilot AI commented Feb 16, 2026

Support for data URLs (data:text/html;base64,...)

This PR adds proper support for data URLs in the InAppBrowser plugin on Android when preventDeeplink is enabled, matching the existing iOS behavior.

Changes

Android (WebViewDialog.java):

  • Added internal scheme detection (data:, blob:, about:, javascript:)
  • Exempted internal schemes from preventDeeplink blocking
  • Enhanced logging to avoid exposing sensitive data

Documentation (README.md):

  • Added "Load HTML Content Directly with Data URLs" section with example
  • Note about btoa() Unicode limitations

Merge Status

  • ✅ Merged with latest main (v8.1.25)
  • ✅ All conflicts resolved
  • ✅ Lint passing
Original prompt

This section details on the original issue you should resolve

<issue_title>Can i add text/html;ba64 as url?</issue_title>
<issue_description>Like this?

var pageContent = '<html><head></head><body><form id="loginForm" action="' + url + '" method="post">' +
    '<input type="hidden" name="username" value="' + this.userName + '">' +
    '<input type="hidden" name="pwd" value="' + this.decryptedPass + '">' +
    '<input type="hidden" name="mobile_token" value="123xyz">' +
    '</form> <script type="text/javascript">document.getElementById("loginForm").submit();</script></body></html>';


  var pageContentUrl = 'data:text/html;base64,' + btoa(pageContent);
  
  InAppBrowser.open({
     url:pageContentUrl,
     headers:{
        backgroundColor:'#ffffff'
     },
     isPresentAfterPageLoad:true
  }).then(res=>{
    console.log(res);
  },err=>{
    console.log(err);
  })
  

Thanks :)</issue_description>

Comments on the Issue (you are @copilot in this section)

@riderx Hello thanks for the answer i'm not sure it's supported by the native browser of platform, but the best is you to try !

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits February 16, 2026 15:49
Co-authored-by: riderx <4084527+riderx@users.noreply.github.com>
…ntation

Co-authored-by: riderx <4084527+riderx@users.noreply.github.com>
Co-authored-by: riderx <4084527+riderx@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for base64 HTML URL in InAppBrowser Support data URLs in Android with preventDeeplink enabled Feb 16, 2026
Copilot AI requested a review from riderx February 16, 2026 15:58
@riderx
Copy link
Member

riderx commented Feb 16, 2026

@copilot the lint is failing, so please ensure lint or format pass. You can run the fmt command to ensure it is automatically formatted the right way.

Co-authored-by: riderx <4084527+riderx@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 16, 2026

@copilot the lint is failing, so please ensure lint or format pass. You can run the fmt command to ensure it is automatically formatted the right way.

Fixed in commit d136348. Ran npm run fmt to apply prettier formatting to the Java code. Lint now passes.

@riderx
Copy link
Member

riderx commented Feb 16, 2026

@copilot please solve the merge conflict with main, and I don't understand what's the relationship with the deep link.

Co-authored-by: riderx <4084527+riderx@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 16, 2026

@copilot please solve the merge conflict with main, and I don't understand what's the relationship with the deep link.

Merge conflict resolved in commit 2d680f0. Both the Full Screen Mode section (from main) and Data URLs section are now present in README.

About the preventDeeplink relationship:

The preventDeeplink option blocks custom URL schemes (like myapp://, tel:) from launching external apps. Android's implementation was blocking ALL non-HTTP/HTTPS URLs, including browser-native schemes like data:, blob:, about:, and javascript:.

These internal schemes should never trigger external apps - they're handled entirely within WebView. iOS already exempted them, but Android didn't.

The fix: We explicitly allow internal schemes even when preventDeeplink=true, so:

  • ✅ Data URLs work for loading HTML content
  • ✅ Custom schemes like myapp:// are still blocked as intended
  • ✅ Cross-platform consistency achieved

This matches the user's original request to use data URLs for base64-encoded HTML content.

@riderx
Copy link
Member

riderx commented Feb 16, 2026

@copilot solve conflict

… section)

Co-authored-by: riderx <4084527+riderx@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 16, 2026

@copilot solve conflict

Conflicts resolved in commit 30d6359.

Resolved:

  • Version updated to 8.1.20 (from main)
  • Data URLs documentation section preserved in README
  • All files merged successfully
  • Lint passing

The branch is now up to date with main while keeping the data URL support feature.

@riderx
Copy link
Member

riderx commented Mar 2, 2026

@copilot fix the conflicts

Co-authored-by: riderx <4084527+riderx@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 2, 2026

@copilot fix the conflicts

All conflicts resolved in d5de0b0. Merged with latest main (v8.1.25) — version numbers updated across all files, data URLs section preserved in README, lint passing.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 2, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can i add text/html;ba64 as url?

2 participants