Skip to content

Instantly share code, notes, and snippets.

@mshafrir
Created March 3, 2026 15:30
Show Gist options
  • Select an option

  • Save mshafrir/9d899a63834ddab332c6f8af8a59c2f0 to your computer and use it in GitHub Desktop.

Select an option

Save mshafrir/9d899a63834ddab332c6f8af8a59c2f0 to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Open Android Settings</title>
<meta name="viewport" content="width=device-width,initial-scale=1" />
<style>
body { font-family: sans-serif; padding: 1rem; }
button { font-size: 1rem; padding: .5rem 1rem; }
#message { margin-top: 1rem; color: #666; }
</style>
</head>
<body>
<h1>Open Android Settings</h1>
<p>
<button id="openBtn">Open Settings</button>
</p>
<div id="message">If the device supports intent:// URIs, Settings should open. If not, you'll see a message here.</div>
<script>
// Intent URI for main Settings
const intentUri = 'intent://#Intent;action=android.settings.SETTINGS;end';
document.getElementById('openBtn').addEventListener('click', function () {
// First try navigation (works in Chrome)
window.location = intentUri;
// As a fallback for browsers that block intent: URI navigation, show instructions after a short delay.
setTimeout(function () {
const msg = document.getElementById('message');
msg.textContent = 'This browser did not open the Settings app automatically. Try using Chrome on Android, or use an app WebView that intercepts intent: URIs.';
}, 1200);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment