Closed Bug 1325846 Opened 9 years ago Closed 9 years ago

anchor download link

Categories

(WebExtensions :: Untriaged, defect)

52 Branch
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: shangerxin, Unassigned)

Details

(Keywords: dom2)

User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729; rv:11.0) like Gecko Steps to reproduce: The anchor tag doesn't work correctly when generate a dynamic link in Extension Here is the simplified example code. <html> <body> <div id="download"> </div> <script> var download = document.getElementById("download"); var link = window.URL.createObjectURL(new Blob([Int16Array.from([1,2,3,4,5])], {type:"arraybuffer"})); var a = document.createElement("a"); a.href = link; a.text = "test.zip"; a.type = "application/zip"; a.download = "test.zip"; download.appendChild(a); </script> </body> </html> Actual results: If the page opened in normal browser window then the generated zip file could be downloaded. If the page is opened from extension then the generated zip file could not be downloaded and the page will stuck in a blank window. Expected results: The dynamic generated zip file should be able to download from extension window. The same logic is works on Chrome.
Keywords: dom2
Component: DOM: Core & HTML → WebExtensions: Untriaged
Product: Core → Toolkit
Flags: needinfo?(kmaglione+bmo)
The default content security policy for WebExtensions does not allow inline scripts. Moving the inline script to a separate .js file should fix the issue.
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Resolution: --- → INVALID
Thank you Kris. The issue should relative to knockout library which we are used to generated the download button.
Product: Toolkit → WebExtensions
Flags: needinfo?(kmaglione+bmo)
You need to log in before you can comment on or make changes to this bug.