On Chrome, Safari and Edge it works fine in editor mode and I view the pdf in the draft/preview (center screen) but on Firefox I get a CORS error and the content studio keeps loading forever, not allowing any change in the content.
We are forcing download on Firefox for now but is there any solution for that?
We have several PDF files in our site and when generating links for them we don’t send the usual attachment link but a common link (like from any other content) then we’ve set a template for all documents with a page that does this redirect, sending them to the attachment link.
What happens is, when opening a document in content studio this redirect still works rendering the PDF loaded but it seem to be loaded in an iframe, which generates a cors error when using Firefox.
Hmm, is it so that Content Studio and your site are on different domains? It works fine for me in Firefox when they are on the same domain. Anyway, you can easily avoid redirect by outputting the binary attachment stream directly (you’ll loose caching though):
var attachments = content.getAttachments(attachmentPath);
var attachmentStream = content.getAttachmentStream({
key: attachmentPath,
name: attachmentName
});
return {
body: attachmentStream,
contentType: attachments[attachmentName].mimeType
};