Member-only story
Opening 11 Million Character HTML in a Mobile WebView: Virtual Chunking
“We’ll just redirect these 227 documents to the browser,” we said. Then, we decided to rescue the Turkish Commercial Law.
Alparslan Selcuk Develioglu (En)11 min read·Just now--
I’ve had a Xiaomi Redmi Note 9S for six years. This phone has done so much for me. It took beautiful photos and created many memories. I dropped it, got it wet; the battery swelled and needed replacing; it left me on Android 12. I wasn’t really playing demanding games, and in normal use, it rarely froze or lagged. That is, until I tried to open the Turkish Commercial Code №6102 in our Vue.js-based Capacitor application.
The screen went black. I touched it, no response. I touched it again, still nothing. The phone started getting hot in my hand. The WebView main thread was suffocating; our native wrapper running a WebView was dying trying to process an 11 million-character HTML block.
The customer asked, “Why is this screen opening so slowly?” I didn’t tell them the truth. Instead, I said, “Let’s investigate.”
First We Measured, Then We Understood
Instead of trusting intuition, we immediately opened the problematic documents on different devices. We told the team about the documents that were causing…