Embedding PDF using <embed> - html

I am trying to embed a PDF in my webpage using this HTML tag
<embed src="instructions_after_extraction.pdf#navpanes=0" style="width:500px; height:375px;" />
If you have noticed, I have turned off the navigation panes using navpanes=0. However, is there a way to specify the available buttons in the toolbar? I'm already aware that toolbar=0 removes the toolbar from the display, but is there a way to turn off each button separately?
Regards.

I don't believe such control exists. However, on a side note, I would be vary of using the embed tag in the first place. An object tag with a number of parameters is the more appropriate solution.

The GUI settings with which a PDF needs to be displayed can be specified by the PDF-creation software too.

Related

Re-parsing a facebook HTML5 comments box

Is there something similar to FB.XFBML.parse() but for the HTML5 versions of the social plugins? I don't want to use XFBML...
Basically, I'm building a one page application that needs to change the comments box's data-href attribute and reload based on what content is accessed inside the app.
Calling FB.XFBML.parse() will also reload/reparse HTML5 Like buttons and other Facebook HTML5 social plugins.
In case somebody else comes across this, FB.XFBML.parse() works perfectly unless you pass a parameter to re-parse only part of the document.
If you want to call FB.XFBML.parse( document.getElementById('foo') ) on a specific element, make sure this element contains the HTML5 social plugin and not the social plugin itself.
Otherwise, FB.XFBML.parse() should work in all cases but it will scan the whole DOM.

How do I stop images or flash from loading into the browser?

I am creating a web page that accepts a hyperlink from the user and displays that page in an iframe. While rendering the page, I would like to show just the text and simple colors, thats it.
I would like to block all the media files like images and flash scripts from showing up.
If not an extensive one, for the starters, I would like to confine the scope to .gif, .jpeg, .jpg, .png, .swf.
Or does anyone know of a site with similar functionality?
You can write a simple dom parser and parse the page before show it in iframe. Then before showing it you can remove whatever you want.
your iframe whould like
<iframe src="your_parser.php"></iframe>
In your parser you can get the content from page using file_get_contents() or curl() it is your choise (i would use curl). Then you can remove the media you want.
If you're using Firefox, use the Adblock Plus extension. You can specify the types of items to block via a filter rule. An example (using Safaribooks) looks like this:
||techbus.safaribooksonline.com/static/201109-2191-techbus/images/6.0/*.jpg
However, if you're talking about incorporating functionality into your page to strip out a specific list of content-types, this approach wouldn't help you. You'd need to pull the html source and strip out the offending content-types.
also if you are using cms. you should be turn off bbcode image, and embed html

Include a webpage inside a div

I have to include a webpage inside my webpage's div. I want somehting like iframe to be done with DIV. Basically, I will be providing a URL to my div and it has to open it inside itself... Do we have something like this in modern HTML? I cannot use frames as some browsers have issues with frames.
Try using an <object> element:
<div style="margin: 0 auto; width:100%; height:400px;">
<object type="text/html" data="**URL to page**"
style="width:100%; height:100%; margin:1%;">
</object>
</div>
Nope. You can't embed a complete HTML document inside another div element as this is a block level element and W3C has defined what could be included inside it.
But there is a workaround. Follow these steps:
Get the document using ajax (jQuery rocks, use that)
Extract the content of the <body> element and put it inside your div element
Get all links and script of <head> element and append them to the <head> element of your existing pgae.
you should use iframe. that's basically what iframes are for. if you stick with modern browsers in any case they don't have issues with iframes (not more than you'll have to face using div's instead)...
You can use iframe or if you decide to use jQuery load function (http://api.jquery.com/load/) you need to avoid the cross script scripting problem - you need to create some sort of proxie take a look at this: WebBrowser Control: Disable Cross Site XSS Filtering or another way to process JS in full on HTML
It should have been in the question itself, but the OP has clarified the reason he does not want to use an iframe is because interframe communication is not allowed. Well, that’s nothing a proxy + postMessage can’t solve.
I believe there is simply no way to actually embed a full document within another one, retaining things like separation of styles and scripts and the like, without using frames in some sense.
This is really an extension to Saeed's response. To get around cross site scripting issues, you will have to write a script on your own server that does a CURL call for the webpage to be embedded. Your javascript will then make a call to this script, passing the URL as a GET/POST parameter.
I agree with a lot of other people here that this is a case where you really should just use an iframe... I believe you can set the iframe with no src tag and manually put the content inside it. That would mean you don't need to take the steps Saeed suggested to break up the head and body. However you still need the script I described to get around cross site scripting.
Actually, I agree with Frédéric Hamidi from above. Just embed an “object” inside a div and reference the URL of the other page in that object.
You can set all the styling for the second page on itself or in a separate CSS file.
That styling gets imported along with the page content without conflicting with the current pages style or scripts.
I tested Frédéric Hamidi’s theory on these browsers, all performed just fine.
• Internet Explorer – v11
• Microsoft Edge - v 84.0.522.59 (Official build) (64-bit)
• Google Chrome – v84.0.4147.105
• FireFox – v79.0
• Brave – v1.11.104
• Opera – v69.0.3686.95
• Safari – v13

If an <object> plugin fails (ie Flash) have it render some other content?

I have a flash header that I show on one of my customers sites, but instead of creating an entire new website for non-flash, is there a way I can have it render a static image version of the header instead of either redirecting or just not rendering the flash content at all (ie with a FAIL message)?
Maybe something like a noscript for object?
And easy way to do this is to use SWFObject.
http://code.google.com/p/swfobject/
A javascript based solution that allows you to create fallback content.
Just put whatever you need inside of the object element and it'll fallback.

What are iframe alternatives?

Is iframe should not be used ever?
how screen reader behaves with
iframed content?
Without iframe how we can embed any
PHP page into asp.net based site?
What are cross browser alternatives?
I don't see why using an iframe is a problem.
If you can't use it then you could either use javascript to download and insert the generated html from the php page, or you could download the html in your asp.net server-side code and insert the html in a control.
Either approach should work well, but using javascript across domains is difficult.
If you go for the asp.net server-side approach you could do the following:
First insert an control where you want to include the html from the php page
In your Page_Load event use the WebClient to download the html as a string
Remove the <html>, <head> and <body> tags so that you only have the pure html markup. You may want to add any script- and css-references to your page if they are needed.
Assign the cleaned html to the Label controls Text property.
This will work, but there are a few points to make:
First you should consider if you trust the source of the php page. If you don't then you will want to do some extra cleaning of the html before displaying it
Second, you will probably want to cache the downloaded html so that you don't have to download it for each page view.