open-url-base-inserted.htm (1025B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>XMLHttpRequest: open() resolving URLs - insert <base></title> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <link rel="help" href="https://xhr.spec.whatwg.org/#the-open()-method" data-tested-assertations="following::ol/li[2]/ol/li[2] following::ol/li[7] following::ol/li[14]/ul/li[2]" /> 8 <link rel="help" href="https://xhr.spec.whatwg.org/#the-responsetext-attribute" data-tested-assertations="following::ol/li[4]" /> 9 </head> 10 <body> 11 <div id="log"></div> 12 <script> 13 test(function() { 14 var client = new XMLHttpRequest(), 15 base = document.createElement("base") 16 base.href = location.href.replace(/\/[^/]*$/, '') + "/resources/" 17 document.getElementsByTagName("head")[0].appendChild(base) 18 client.open("GET", "folder.txt", false) 19 client.send(null) 20 assert_equals(client.responseText, "bottom\n") 21 }) 22 </script> 23 </body> 24 </html>