fix: replace iframe with link in build_inspect_data - #485
Conversation
cppreference.com sets X-Frame-Options: DENY (MediaWiki default), which causes every browser to block the <iframe> used in build_inspect_data. Replace it with a plain <a> anchor that opens the documentation URL in a new tab, keeping the existing text/plain field intact. Adds a unit test asserting the output contains an <a href> and no <iframe>. Fixes compiler-research#484
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #485 +/- ##
==========================================
+ Coverage 73.99% 74.01% +0.02%
==========================================
Files 23 23
Lines 1196 1197 +1
Branches 111 111
==========================================
+ Hits 885 886 +1
Misses 311 311
🚀 New features to boost your workflow:
|
|
clang-tidy review says "All clean, LGTM! 👍" |
anutosh491
left a comment
There was a problem hiding this comment.
Curious as to how the deployment looks like (maybe share a screencast or an image ?)
We also have a solution here : #484 (comment)
|
I could not capture this inside a live xeus-cpp deployment, both linked JupyterLite demos currently load Lab but expose no C++ kernel, so I reproduced the pager payloads directly in Chrome against en.cppreference.com. Same HTML, same origin behaviour. The result changed my mind about this PR, so let me lead with that. The blocker is Article views send no So there is a third option nobody in #484 has raised, and I think it beats both on the table: delete Two caveats. Happy to reshape #485 into the one-line removal if you agree, keeping the test but asserting the emitted src no longer carries the purge suffix. Separately, unrelated to this PR: both https://compiler-research.github.io/xeus-cpp/lab/index.html and https://compiler-research.org/xeus-cpp-wasm/lab/index.html load Lab but offer no C++ kernel in the launcher or kernel picker, so notebooks open with "No Kernel". Might be worth a look. |
@mvanhorn I tried both deployments and the kernels are there for me. In the past when the kernels have not appeared for me it was because I changed the config on my browser and that somehow effected it. No idea why. I just reset my browser config to the defaults and they appeared again. I say this not knowing if it will help you. |
|
I am for a technique which avoids opening the documentation in a new tab or window. I have been learning about accessibility in web pages recently, and |
|
Hey @mvanhorn, We would love if the behaviour is as close as what we had originally i.e the docs render below the cell that calls for it ! If you're approach can get us to that, let's go for it. |

Summary
<iframe>inbuild_inspect_data(src/xinspect.cpp) with a plain<a>anchor that opens the documentation URL in a new tab#pager-container/.xcpp-iframe-pagerCSS blocktest/test_interpreter.cppthat asserts the returnedtext/htmlcontains an<a href>and no<iframe>Why this matters
Closes #484. cppreference.com migrated to MediaWiki, which sets
X-Frame-Options: DENYby default as a deliberate security policy. This blocks the<iframe>pager in every browser (Chrome, Safari, JupyterLite), leaving the Shift+Tab inspect panel blank for all users. The maintainer confirmed that changing the cppreference server config is not feasible, so the fix must be on the xeus-cpp side. A clickable link is the simplest correct replacement - it requires no special permissions and works in all Jupyter environments.Fixes #484