Closed trogper closed 4 years ago
Why do we need this? The raw xml is already wrapped in a <pre lang="xml"></pre>
tag and is formatted to xml by the browser. See http://www.techsneeze.com/wp-content/uploads/2020/07/dmarcts-report-viewer.ReportDetailWithXML.png
The tag has support from all the major browsers. See https://www.w3schools.com/tags/tag_pre.asp
It works for me in the latest versions of Chrome, Firefox and Waterfox on Linux. Is there a specific browser or case where <pre lang="xml">
doesn't work?
I didn't even know browsers supported this, when I opened the XML viewer first time, it was just two lines. It seems that webkit (safari and every browser on iOS) does not support it. I have checked just now on iPadOS 14.0.1 with Chrome 85.0.4183.109 and it is the same, two lines only. Edit: so it is caused by reports from mail.ru. Reports from gmail.com and others are just fine. Will have to investigate further
Hmm, interesting.
Can you post a mail.ru report (suitably scrubbed of personally identifiable data, of course)?
The <pre lang="xml">
doesn't work for even simple xml such as <xml><a>asdjo</a><v>qwer</v></xml>
. XML reports from gmail come already formatted, that's why it looks ok, but mail.ru sends non-formatted.
mail.ru report.zip
and my "enhancement" doesn't even work too, because I'm calling the function from the wrong place and formatting innerHTML 🤦♂️
So I moved the formatting from js to php, it works now. Thanks for assistance and sorry if I bothered you
Absolutely no bother. We need to know if code doesn't work.
Your code works well for me on both formatted and unformatted xml. Nice, elegant solution. Thanks!
I'm not the repository owner so I can't merge the request but I'm sure @techsneeze will review it soon.
this PR adds js function for XML formatting and applies it when showing the xource XML for dmarc reports