Content-Disposition header filename is ignored when 'download' attribute is specified...
[WebKit-https.git] / LayoutTests / http / tests / download / anchor-download-attribute-content-disposition.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script type='text/javascript'>
5 if (window.testRunner) {
6   testRunner.dumpAsText();
7   testRunner.waitUntilDone();
8 }
9 </script>
10 </head>
11 <body>
12 <p>Tests that the filename from the Content-Disposition header is used even if a download attribute is specified in HTML.</p>
13 <p>The suggested filename above should be "PASS.txt" and the download should succeed.</p>
14 <a id="download-url" href="resources/content-disposition-pass.php" download="FAIL.txt">Link with download attribute.</a>
15 <script>
16 function click(elmt)
17 {
18     if (!window.eventSender) {
19         alert('Click the link to run the test.');
20         return;
21     }
22     eventSender.mouseMoveTo(elmt.offsetLeft + 5, elmt.offsetTop + 5);
23     eventSender.mouseDown();
24     eventSender.mouseUp();
25 }
26
27 function runTest()
28 {
29     var link = document.getElementById("download-url");
30     click(link);
31 }
32 runTest();
33 </script>
34 </body>
35 </html>