A simple static web application that allows you to open URLs on one device from another using QR codes.
- Device 1 (PC/Desktop): Displays a unique QR code
- Device 2 (Mobile): Scans the QR, enters a URL
- Device 1: Automatically opens the specified URL
- A Firebase project (free)
- A local web server or static hosting (GitHub Pages, Netlify, Vercel, etc.)
- Go to Firebase Console
- Click "Add project"
- Follow the steps to create your project
- Once created, go to "Realtime Database" in the side menu
- Click "Create database"
- Select the location closest to you
- Start in test mode (allows read/write for 30 days)
⚠️ IMPORTANT: For production, configure appropriate security rules
- The database is ready
- In the Firebase console, go to "Project settings" (⚙️ icon)
- Scroll down to "Your apps"
- Click the
</>icon (Web) - Register your app (give it a name)
- Copy the
firebaseConfigthat appears
- Open
index.html - Find the
firebaseConfigsection (line ~111) - Replace the values with your configuration:
const firebaseConfig = {
apiKey: "YOUR_REAL_API_KEY",
authDomain: "your-real-project.firebaseapp.com",
databaseURL: "https://your-real-project-default-rtdb.firebaseio.com",
projectId: "your-real-project",
storageBucket: "your-real-project.appspot.com",
messagingSenderId: "123456789012",
appId: "1:123456789012:web:abcdef123456"
};- Repeat the same in
remote.html(line ~158)
# Using Python 3
python -m http.server 8000
# Or using Node.js (npx http-server)
npx http-serverThen open http://localhost:8000 in your browser.
- Upload the files to a GitHub repository
- Go to Settings → Pages
- Select the branch and folder
- Your site will be at
https://your-username.github.io/your-repo
- Drag the folder to Netlify Drop or use Vercel
- Your site will be ready in seconds
- On your PC: Open
index.htmlin the browser - You'll see a QR code generated automatically
- Scan the QR with your phone
- Enter the URL you want to open on your PC
- Your PC will automatically open that URL
For production, update the Firebase Realtime Database rules:
{
"rules": {
"sessions": {
"$sessionId": {
".write": true,
".read": true,
".validate": "newData.hasChildren(['url', 'timestamp'])",
"url": {
".validate": "newData.isString() && newData.val().length < 2048"
},
"timestamp": {
".validate": "newData.isNumber()"
}
}
}
}
}You can also add automatic session expiration:
{
"rules": {
"sessions": {
"$sessionId": {
".write": "!data.exists() || data.child('timestamp').val() > (now - 3600000)",
".read": true,
".validate": "newData.hasChildren(['url', 'timestamp'])"
}
}
}
}scaan.in/
├── index.html # Main page (Device 1)
├── remote.html # Control page (Device 2)
└── README.md # This file
- HTML5 / CSS3 / JavaScript (Vanilla)
- Firebase Realtime Database
- QRCode.js
- Security: This is a demonstration implementation. For production, implement authentication and appropriate security rules.
- HTTPS: Firebase requires HTTPS in production. Use hosting that provides it (GitHub Pages, Netlify, Vercel do this automatically).
- Free tier limits: Firebase Realtime Database has generous limits on the free tier:
- 1 GB of storage
- 10 GB/month of data transfer
- 100 simultaneous connections
- Verify that you've configured Firebase correctly
- Open the browser console (F12) to see errors
- Make sure the
databaseURLURL is correct
- Verify that both devices have Internet access
- Make sure Firebase rules allow read/write
- Check that the Firebase configuration is identical in both files
- Verify that the URL has the correct format (with http:// or https://)
- Some browsers block automatic redirects - allow pop-ups
- Check the browser console for errors
MIT - Free to use
Contributions are welcome! Feel free to open issues or pull requests.
