Part 4: Assessment Solver II: Cross-Origin Techademy Iframes, IAP & Fullscreen HUD
Part 4: Assessment Solver II — Cross-Origin Techademy Iframes, IAP & Fullscreen HUD
Infosys Springboard doesn't use a single exam player across all of its courses. Depending on which course or certification you open, clicking an assessment drops you into one of three completely different interfaces:
1. Standard Springboard Quizzes: Rendered right inside the Angular /viewer/quiz/ page with radio/checkbox inputs and a Next / Submit bar.
2. Multi-Section IAP Assessments: Fullscreen exams with an Instructions screen (Start), a SECTIONS tab containing multiple section cards (Attempt Section / Resume Section), a numbered question palette (1..N), Save & Next buttons, and a two-step final submit flow (Finish test → Submit).
3. Cross-Origin Techademy Assessments (/viewer/html/): The hardest one to automate. The browser's address bar stays on https://infyspringboard.onwingspan.com/web/en/viewer/html/..., but the actual exam UI—questions, options, topic accordions, and Save & Next buttons—is hosted inside a cross-origin <iframe> served from external domains like *.techademy.com, *.techademyone.com, *.yaksha.com, or *.iiht.com.
Because of the browser's Same-Origin Policy, a content script running in the top Springboard frame (onwingspan.com) throws a SecurityError the instant it tries to read iframe.contentDocument. In this fourth part of the Building SpringBored series, we will walk through how we solved cross-origin Techademy iframes and multi-section IAP navigation (especially in commits a46092b and 4ebb7e2) while keeping a single draggable Fullscreen HUD in the top window.
1. Running all_frames: true Safely with a Line-1 Top-Frame Guard
To read questions and click options inside a cross-origin iframe, manifest.json has to enable "all_frames": true and include host permissions for third-party LTI assessment domains. If you turn on "all_frames": true without a domain check, though, your content script will mount its floating HUD on every website you visit.
To make sure SpringBored - Assessment never runs on non-Springboard websites, content.js checks window.location.hostname at line 1 whenever window === window.top. If the top-level tab isn't Infosys Springboard or a known assessment host, the script exits immediately before registering any listeners or touching the DOM:
// When running in the top-level frame, only activate on Infosys Springboard
// or known assessment domains (child iframes may be hosted on any LTI/assessment origin).
if (window === window.top) {
const proto = window.location.protocol;
const host = (window.location.hostname || "").toLowerCase();
const allowedTopHost =
proto === "file:" ||
host === "localhost" ||
host === "127.0.0.1" ||
host.includes("onwingspan.com") ||
host.includes("springboard.infosys.com") ||
host.includes("infosys.com") ||
host.includes("infosysapps.com") ||
host.includes("techademy") ||
host.includes("yaksha") ||
host.includes("iiht");
if (!allowedTopHost) return;
}
And when window !== window.top (meaning content.js is running inside a child iframe)? Inside a child iframe, the script never renders a duplicate HUD overlay and stays completely idle until it detects actual exam questions (hasActualAssessmentContent()) and receives a START command for that tab.
2. Avoiding Split-Brain Runs with ACQUIRE_SOLVER_LOCK
When all_frames: true is enabled on a page that has the top window (frameId: 0) plus two or three child iframes (frameId: 4, frameId: 5), broadcasting { action: 'START' } reaches all of those frames at the same time. If two frames both start running the solver loop simultaneously, they will fight over the page and double-click buttons.
To guarantee only one frame per tab can run the solver at any time, background.js maintains an in-memory lock table (solverLocks) with a 15-second heartbeat TTL:
// Map<tabId, { frameId, acquiredAt }>
const solverLocks = new Map();
const SOLVER_LOCK_TTL_MS = 15 * 1000;
if (message.type === 'ACQUIRE_SOLVER_LOCK') {
const tabId = sender.tab?.id;
const frameId = sender.frameId ?? 0;
if (!message.force) {
const existing = solverLocks.get(tabId);
const isStale = existing && Date.now() - existing.acquiredAt > SOLVER_LOCK_TTL_MS;
if (existing && existing.frameId !== frameId && !isStale) {
sendResponse({ granted: false, ownerFrameId: existing.frameId });
return false;
}
}
solverLocks.set(tabId, { frameId, acquiredAt: Date.now() });
sendResponse({ granted: true, ownerFrameId: frameId });
return false;
}
Here is what happens when you press Alt + S or click Solve assessment on a /viewer/html/ Techademy page:
1. The top frame (frameId: 0) sees that it embeds a child assessment <iframe> and has no question stem of its own. Instead of throwing a "No questions found" error, it sends BROADCAST_START to background.js and switches its HUD into Remote Child Display Mode (remoteChildRunning = true).
2. Inside the cross-origin Techademy iframe (frameId: N), content.js finds the question stem and options, claims ACQUIRE_SOLVER_LOCK for the tab, and starts solving.
3. Relaying Child-Iframe Status & AI Logs to the Top HUD
Why not just mount the HUD inside the child iframe that is solving the questions? Two reasons:
- Child iframes often have internal scrollbars or fixed dimensions that clip floating overlays.
- When you open the toolbar popup (
popup.js), queryingframeId: 0would report"idle"if only the child iframe knew a run was active.
To keep one clean Fullscreen HUD in the top window (window.top) while the child iframe does the actual work, background.js intercepts every STATUS_UPDATE and AI_LOG_ENTRY sent from a child frame (sender.frameId !== 0) and forwards it to frameId: 0:
if (message.type === 'STATUS_UPDATE') {
if (sender.tab?.id !== undefined) {
tabStatuses.set(sender.tab.id, { ...message, receivedAt: Date.now() });
// Forward child-iframe progress & status to the top frame (frameId 0)
// so the floating HUD in window.top updates in real time!
if ((sender.frameId ?? 0) !== 0 && chrome.tabs?.sendMessage) {
chrome.tabs
.sendMessage(sender.tab.id, { ...message, relayedFromChild: true }, { frameId: 0 })
.catch(() => {});
}
}
chrome.runtime.sendMessage(message).catch(() => {});
return false;
}
With that relay in place, the top-window HUD updates its question counter (Solving Q14/25), active model badge (Gemini 2.5 Flash), Pause / Resume / Stop buttons, and Live AI Inspector drawer (Sent Prompt + AI Answer: [B, D]) seamlessly—even when the exam is running inside a cross-origin iframe.
4. Two Real-World Navigation Bugs We Fixed (4ebb7e2 & a46092b)
Building a DOM navigator for real exam platforms always uncovers quirky UI edge cases. Here are two bugs that bit us during testing and how we fixed them:
Bug 1: Sidebar Count Badges Pretending to Be Question Numbers (4ebb7e2)
In both IAP and Techademy exams, the question palette displays clickable numbered badges (1, 2, 3, ..., 25) to jump between questions. However, the left sidebar also displays small number badges next to topic or section headers showing how many items are inside—such as Topics (6) or Unanswered [12]—using similar badge elements whose text is just an integer ("6").
In an earlier build, our palette finder (getQuestionPaletteButtons()) matched that "6" badge inside the Topics accordion header and clicked it—which collapsed the Topics sidebar instead of jumping to Question 6! In commit 4ebb7e2, we fixed that by:
- Filtering out any number badge nested inside an accordion header, tab label, or summary counter (
[role="tab"],.accordion-header,.section-header,.topic-count). - Advancing sequentially via
Save & Nexton Techademy assessments first, and only expanding collapsed Topics accordions in the left sidebar once the current topic's questions are done.
Bug 2: Clicking "Finish Test" After Section 1 of a 3-Section Exam (a46092b)
On a Multi-Section IAP assessment with three sections, the top-right Finish test / Submit button stays visible in the header bar on every single question of Section 1. When our early solver reached the last question of Section 1 and saw no Next button, it saw Finish test in the header and clicked it—submitting the exam before Sections 2 and 3 were even opened!
In commit a46092b, we updated the IAP state machine so that at the end of a question list, it checks for a SECTIONS tab or Back to Sections button first. It returns to the SECTIONS dashboard, looks for any remaining cards with Attempt Section or Resume Section, and only clicks Finish test / Submit after every section card is complete.
Quick Takeaways
- Use
background.jsas a message broker between cross-origin frames: You don't need brittlewindow.postMessage('*')listeners exposed to the page whenchrome.tabs.sendMessage(tabId, msg, { frameId: 0 })can relay child-frame state securely over the extension runtime bus. - Filter out header and accordion count badges when scraping numbered palettes: Just checking
/^\d+$/on button text will eventually click a category count badge.
Series Navigation: ← Previous: Part 3: Assessment Solver I — DOM Scraping, Gemini Fallback & Two-Pass Critic | Next: Part 5: Cloudflare KV Telemetry, Security Hardening & the GitHub Update Engine → | All Articles