PDF as blank page in HTML - html

My problem is, everything is fine opening PDFs using my browsers, until I uploaded a pdf with a form inside. Then, if I embed it, it returns a blank page. But the other pdfs with forms open normally. Please see my code below:
<object data="{{ asset($test->file_path) }}" type="application/pdf" width="100%" height="100%">
<embed src="{{ asset($test->file_path) }}" type='application/pdf'>
<center>
Please click here to view
</center>
</object>
Note: I've also tried to use <iframe> but still returns blank page.
Solution:
option1:
Renamed my file that has # sign. And everything should work fine.
option2:
Use urlencode if needed.

Please click here to view

It's late, and I'm tired, so apologies if I misread the question.
I noticed that the PDF is hosted on a site that doesn't support HTTPS. It showed a blank page if it was embedded on a site using HTTPS, but worked fine when it was using HTTP.
I think you need to either move the PDF to a site that supports HTTPS or make the site hosting the PDF start using HTTPS.

Consider using Objects and Iframes (Rather than Object and Embed)
Something like this should work for you:
<object data="http://foersom.com/net/HowTo/data/OoPdfFormExample.pdf" type="application/pdf" width="100%" height="100%">
<iframe src="http://foersom.com/net/HowTo/data/OoPdfFormExample.pdf" width="100%" height="100%" style="border: none;">
This browser does not support PDFs. Please download the PDF to view it: Download PDF
</iframe>
</object>
This worked when I tested it locally but I can't show JSFiddle since it uses HTTPS.
Also, have a look at these examples: https://pdfobject.com/static.html

Not sure if this will work as I am not able to test your case. You can try this, it always works for me. Try replacing http://yoursite.com/the.pdf with the correct path.
<object data="http://yoursite.com/the.pdf" type="application/pdf" width="750px" height="750px">
<embed src="http://yoursite.com/the.pdf" type="application/pdf">
<p>This browser does not support PDFs. Please download the PDF to view it: Download PDF.</p>
</embed>
</object>

Related

Download Audio/Video file using iframe

Currently my iframe is showing the Video/Audio instead of downloading it.
Zip files work fine though.
Thats the code:
<iframe width="0" height="0" frameborder="0" src="https://example.com/downloads/1.mp3"></iframe>
Any Solutions?
if you want to make it download why are you using a iframe? you can simply do this
Download

My youtube embed code doesn't work on html website

<center>
<iframe width="420" height="315" src="//www.youtube.com/embed/BrI7VRfqgo4" frameborder="0" allowfullscreen></iframe>
I know its been posted around, but nothing's been working for me at the moment. I have HTML website and trying to put the html video youtube embed code, but its not working for me.
My site is online, very simple html.. And it has http in the video embed code as well..
I tried a lot, but cant get it working in any way.
Regards
You have to enable embedding first before the embed code will work from other websites.
Log in to https://www.youtube.com/my_videos?o=U
Click Edit on the video you want to embed
Click on Advanced Settings in the tab below
Click Allow Embedding to enable it under the Distribution options section.
Click Save Changes to save the new configuration.
Now your embed link is ready to be embedded on other websites!
<p align="left">
<object height="385" width="640">
<embed src="http://www.youtube.com/v/LsEU_93SC4c&rel=0?fs=1&hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" height="385" width="640">
</object>
</p>
Change the third line to your video number/name.
I don'tknow it it can be of any help.
I needed just the audio, so I changed height to "0" and width to"0" and it works on IE and Firefox.
It doesn't work with Chrome and Opera.
Here the simple link.
Just insert it as it is. I inserted it at the bottom of the page before
or go to my age and see if how it works:
https://www.carniaexpress.com/friuli-per-gruppi/raduno-alpini-triveneto-tolmezzo
If you wish to see the video just change height and width...

Alternative to embed tag?

I am trying to embed a PHP page in another HTML page using the embed tag, however on firefox it shows up as just a grey box. It works fine on google chrome. According to a google search, <embed> is deprecated and they suggest using the <object> tag however is it possible to use that with text/html and not an image or swf/media ?
My current code: <embed src="post.php" height="35" width="850">
You could try using the following:
<object data=http://www.example.com/page.php width="850" height="35">
<embed src=http://www.example.com/page.php width="850" height="35"> </embed>
Error: The page could not be embedded.
</object>

Param Element in Object not working in Firefox

I have a very basic html page which takes a parameter to render a pdf file with the object tag. I was seeing this page work correctly in Chrome and IE but failing in Firefox. As a proof of concept I broke it down into an even simpler scenario which works in Chrome/IE and fails in Firefox.
<object width="100%" height="100%" type="application/pdf">
<param name="src" value="myFile.pdf">
</object>
However if I use something like the below block then it renders fine in all browsers. Any ideas why the example above wouldn't work in Firefox?
<object width="100%" height="100%" type="application/pdf" data="myFile.pdf">
</object>
It looks like the data attribute is the standard way of specifying the file. According to Mozilla's documentation the data attribute is required on the object tag.

Youtube video isn't showing in Chrome, but shows in Firefox

Thank you for your help.
On my site I am embedding youtube videos. Where the video is suppose to be it isn't showing up, in chrome. It works on a macs and it also works on PCs, but only on firefox. Where the video is suppose to be you can "click" on the video and it will start playing, but it is not visible. How do I get it to show up. I thought it might be hiding behind stuff, so I messed with some z-index stuff, but it isn't working. Is there something else I should be looking at?
This is how the code is:
<object type="application/x-shockwave-flash" id="myytplayer" data="https://www.youtube.com/v/FJqOb-TS-0o&enablejsapi=1&playerapiid=ytplayer&version=3&controls=0&showinfo=0&rel=0" width="500" height="348">
<param name="allowScriptAccess" value="always">
</object>
The video is being pulled from my data base, but is being hosted by YouTube.
Here is the code on firefox:
<object id="myytplayer" width="500" height="348" type="application/x-shockwave-flash" data="https://www.youtube.com/v/FJqOb-TS-0o&enablejsapi=1&playerapiid=ytplayer&version=3&controls=0&showinfo=0&rel=0">
<param name="allowScriptAccess" value="always">
</object>
I have tried updating my flash drives to see if that is a problem. I have deleted my cookies. I have even had other people try it out and it just doesn't show up in chrome. Any help would be awesome.
Both your snippet of codes works fine in my Chrome 34 Windows 8.1 machine. Not sure where your issue is coming from. Maybe a system/network/proxy settings specific to Chrome on machines where you are trying from (sometimes Youtube URL are banned from company network).
I would point to the Youtube documentation anyway. Maybe trying another form of embed can help:
Best practice: IFrame embeds are the recommended method for embedding a YouTube player because the IFrame will select the appropriate player based on the client's capabilities and available YouTube file formats.
If you use the object tag you should have an embed tag falback inside (see the doc).