Alternative to embed tag? - html

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>

Related

Is it possible to use Ruffle within an Iframe?

So ive been trying to use Ruffle (a flash emulator written in Rust) on a website for some flash games. This works like a charm with flash games in my website source files, but it doesnt work for iframes. This is the code that ive been trying to get working, but at this point im not sure if its possible at all. any help?
<script src="ruffle/ruffle.js"></script>
<iframe id="cppscreatorCPPS" src="https://play.cppscreator.xyz/embed/24436" scrolling="no" width="960" height="600" frameborder=0></iframe>
<br /><br />```
Instead of an <iframe>, I would recommend you used an <object> and <embed>component. I will leave a code snippet below (You need to replace the value of the param and the src of the embed with your swf file link. In your case, it is the play.cppscreator.xyz/embed link. ). Also, you are using cppscreator.xyz, which does not really work, as it is not an SWF file.
<script src="https://flash-games.penguinbotcoder.repl.co/ruffle/ruffle.js"></script>
<object width="600" height="400">
<param name="movie" value="https://flash-games.penguinbotcoder.repl.co/flashgames/thinice.swf">
<embed src="https://flash-games.penguinbotcoder.repl.co/flashgames/thinice.swf">
</embed>
</object>

How to show first page of pdf with embed tag?

I'm using <embed> tag to show pdf on a website but it shows the second page no matter what I do. Suggestions?
My code:
<embed src="blablabla.pdf#page=0" type="application/pdf" width="100%" height="980px" />
Thanks!

PDF as blank page in 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>

Navigation for PDF inside <object> tag

I am using <object> tag to display PDF on my web page. Weather there is an option to add a Previous and Next Button For navigate each page in PDF.
I have googled this issue but haven't found any solution.
<object data="myfile.pdf" type="application/pdf" width="100%" height="1000">
<p>Click Here TO Download PDF!</p>
</object>
Any other plugins available

HTML alternative if plugin is not available

What is the best practice for displaying an HTML alternative when a browser plug-in is not available? I'm embedding the plugin with an object tag like so:
<object id="plugin0" type="application/x-myplugin"></object>
This is what an unknown plugin displays as in Google Chrome, however I'd like the solution to work on all browsers (i.e. FF plugin/Chrome plugin/IE ActiveX object)
-foot
If you're talking about flash, whatever you place within the object tag will show up if flash is not supported.
Here's an example of a flash movie with a fallback image:
<object type="application/x-shockwave-flash data="yourmovie.swf" width="400" height="300">
<param name="movie" value="yourmovie.swf" />
<img src="noflash.gif" width="200" height="100" alt="" />
</object>
I typically test for plugins using javascript and write to the page based on the test results.