fix(Challenges/frame.js): Make iframe href base relative to / (#16221)
This prevents requests from appending to the current challenge url
This commit is contained in:
committed by
Stuart Taylor
parent
1dae80ad1b
commit
65356ff7e7
@ -11,7 +11,15 @@ const mainId = 'fcc-main-frame';
|
|||||||
// the test frame is responsible for running the assert tests
|
// the test frame is responsible for running the assert tests
|
||||||
const testId = 'fcc-test-frame';
|
const testId = 'fcc-test-frame';
|
||||||
|
|
||||||
|
// base tag here will force relative links
|
||||||
|
// within iframe to point to '/' instead of
|
||||||
|
// append to the current challenge url
|
||||||
|
// 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) => `
|
const createHeader = (id = mainId) => `
|
||||||
|
<base href='/' target='_blank'/>
|
||||||
<script>
|
<script>
|
||||||
window.__frameId = '${id}';
|
window.__frameId = '${id}';
|
||||||
window.onerror = function(msg, url, ln, col, err) {
|
window.onerror = function(msg, url, ln, col, err) {
|
||||||
|
Reference in New Issue
Block a user