ShadowMage Posted July 31, 2020 Share Posted July 31, 2020 This is strange but recently my page stopped displaying PDFs using the object tag. Nothing has changed on the page (in fact, I haven't worked with it in a very long time and there's no one else besides my supervisor who can edit it; I'm 99.99999% sure he hasn't touched it either). I guess what I want to ask is if there's anything that looks out of place with my code: $x = 0; foreach ($arrPDF as $pdf) { echo "<object id='bulletin".$x."' data='../path/".$pdf."' type='application/pdf'>\n"; echo "<span class='error'>Error: Could not load PDF. Your browser does not support embedded objects.</span>\n"; echo "</object>\n"; $x++; } This code used to work, then just seemingly at random one day, it decided not to. Used to display the PDFs, now I just get the error message. Any suggestions? I've already tried updating the browser. I've tried it in FireFox, Chrome, and Edge. None of them display the PDFs. Everything I've seen online about the <object> tag suggests this code should be just fine. Is there a different/better way to embed a PDF that I'm not finding? Link to comment Share on other sites More sharing options...
Ingolme Posted July 31, 2020 Share Posted July 31, 2020 I'd suggest using an iframe instead. Link to comment Share on other sites More sharing options...
ShadowMage Posted August 21, 2020 Author Share Posted August 21, 2020 Totally forgot I posted this until I was asked about it again this morning... On 7/31/2020 at 5:44 PM, Ingolme said: I'd suggest using an iframe instead. I thought iframes were deprecated or not recommended? Link to comment Share on other sites More sharing options...
Funce Posted August 23, 2020 Share Posted August 23, 2020 They're... a bad cover for a bad design decision in the most cases you see them used. In this example, you might be able to leverage the native browser PDF viewers with an iframe. Give it a bit of science. Link to comment Share on other sites More sharing options...
dsonesuk Posted August 24, 2020 Share Posted August 24, 2020 That was the days of html4 with strict doctype no longer supporting it, it was my main gripe as there was not cross browser support for anything else similar, so you had to use transitional doctype which allowed iframes. Then whoever realised what a major blunder they made, and it was resupported in html5 2 Link to comment Share on other sites More sharing options...
ShadowMage Posted August 24, 2020 Author Share Posted August 24, 2020 ah, ok. I'll give it a shot with iframes then. Thanks guys. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now