Removed the base tag from the header of the preview iframe. The href and target attributes were causing links within the iframe to open a new tab and would point to /, which created problems with some challenges where users should link to other page elements like a footer.
Fixed an error found in QA where in-page anchors would work as expected in Chrome, but in FireFox would load another instance of Learn in the iframe. If the user goes back to the challenge, though, the in-page anchors work as expected. Readded <base> and had it point to href='' to get in-page anchors working in both Chrome and FF.
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
b9d38ff901
commit
b29ae0df28
@ -13,14 +13,17 @@ const mainId = 'fcc-main-frame';
|
||||
const testId = 'fcc-test-frame';
|
||||
|
||||
// base tag here will force relative links
|
||||
// within iframe to point to '/' instead of
|
||||
// within iframe to point to '' instead of
|
||||
// append to the current challenge url
|
||||
// this also allows in-page anchors to work properly
|
||||
// rather than load another instance of the learn
|
||||
//
|
||||
// if an error occurs during initialization
|
||||
// the __err prop will be set
|
||||
// This is then picked up in client/frame-runner.js during
|
||||
// runTestsInTestFrame below
|
||||
const createHeader = (id = mainId) => `
|
||||
<base href='/' target='_blank'/>
|
||||
<base href='' />
|
||||
<script>
|
||||
window.__frameId = '${id}';
|
||||
window.onerror = function(msg, url, ln, col, err) {
|
||||
|
Reference in New Issue
Block a user