<object> doesn't appear when data=google.co.uk - html

I want to embed the google home page in a page on my website. I want to use the <object> html5 element because from what I've read this is the most up-to-date way to do this and should work on ie7+ and everything else.
But I'm having problems getting it to work. Here's what I'm using:
<object type="text/html" data="http://www.google.co.uk" style="width: 1000px; height: 600px;"></object>
If I change the url to something different it works fine, but with google... nothing.
Am I missing something? I can't figure out what I'm doing wrong?

this is the most up-to-date way
It isn't. <object> is simply a generic way. It is inconsistently supported.
If you want to embed HTML documents, use an iframe.
That won't help in this situation though. In the HTTP headers for the page, Google say:
X-Frame-Options: SAMEORIGIN
They are forbidding you from embedding their page inside yours, and your browser is respecting their wishes.

Related

Firefox tells user they need a plugin to display an embedded webpage

There's a section on my site where I display data from another site, using:
<embed src="URL"></embed>
I recently discovered that this works fine for most people, but that Firefox users get an error telling them they need to install a plugin. I searched around for a solution and people seemed to find that specifying the MIME type worked:
<embed type="text/html" src="URL"></embed>
But this isn't working. I can switch to iFrames, but I dislike how they display the information. Any other suggestions?
Per spec, embed elements are only handled via plug-ins or an SVG renderer (and in the latter case behave just like iframe).
You can do <object data="URL"></object>, but of course that will also behave like iframe...
I've been having the same issue with an html5 game. It appears that Firefox doesn't support if you want to embed an external html file. This tag should only be used for plugins.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/embed
To embed an external html file into another page in Firefox you have to use iframe or object tags instead. For the interactive nature of my external page I used iframe and it worked in IE / Chrome and FF, I had to make the margins larger than the game itself.

Embed XML in HTML (for Mozilla Nightly)

I've seen that there is another post with a similar name, but it doesn't help me.
I use this:
<embed src="../xml/menu.xml" />
to embed some XML content in a div from an HTML file. It is working (the content is displayed) in Google Chrome and Internet Explorer, but not in Mozilla Nightly.
Do you know how to make it work even for Nightly?
Use <object> instead. Per spec, <embed> will only show content handled via plug-ins and SVG, not random document types like XML.

Embedding Html page inside another Html page without using iFrames

I ran into an issue where one of my customer's browser does not support iFrames (rather his Outlook does not). Without using iFrames, how can i display another page's content inside Html? Original iFrames insert looked as following:
<iframe src="http://mybox:8081/blah/report.jsp" width="1000" height="420">
<p>Your browser does not support iframes.</p>
</iframe>
Please advise. Thank you.
You cannot without using an iFrame.
Your options are even more limited because you're working with an email client. HTML in email clients are very finicky.
It seems you are using an email client, which definitely doesn't support iFrames, but for reference, you can do this with jQuery on a website.
$(document).ready(function() {
$(".yourSelector").load("/pages/pageyouwanttoloadhtmlof.html");
});
Please note that .load will strip out scripts in most cases (there are uses that won't), and also note that you cannot load content from different domains than yours. (There are ways around this with things like jsonP, but that gets quite complicated, and you pretty much still have to control both domains.
You can use a DIV to display it, another page content should set using DIV's inner html property

Show SVG files on Sharepoint 2007

I'm building a WSS site which has to show SVG files stored on WSS.
I'm trying to use <object> tag to show it and it doesn't show, however, if I use <embed> it works ok. Im'using IE8 and IE7
I've been reading and everyone tells IE prefers <Object> over <embed>, but in WSS it doesn't work this way.
To display the file I'm using a web content editor webpart with this code:
<object type="image/svg+xml" data="/samples/sample.svg"
name="owMain" width="400" height="150">
</object>
Any clue??
I've found that it's not actually necessary to embed SVG as an object.
If you use the SVGWeb JavaScript library, you can actually put your SVG into a normal Content Editor Web Part via the Source Editor, and manipulate the SVG elements via JavaScript.
The library can also work with a referenced SVG file as an object, but I haven't tried that option.
The library is hosted on code.google.com
You cannot add object tags to the html content of a page in WSS. The issue is that the object tag can be used in lots of very bad ways, so it is stripped out by the underlying engine.
You have found that the content editor webpart does not suffer from the same limitations.
The first step, if you haven't already, is to confirm that the HTML content in the response is as you expect (e.g. view source). If it isn't then you've found your issue. If it is, the next step might be to use a debugging proxy like Fiddler to confirm that all of the related requests are being made and handled as you expect. If they're not then you've found your issue (e.g. security). If they are then by the process of elimination you can safely conclude that either the markup or the browser is lacking.
Is it me or IE does not support SVG? Well, it kinda does but it is tricky and it's to draw, not to show svg files. ... If you open with FF can you see what you are expecting?
added
I made an svg draw in IE ... it's not the same, I know, but it's something that you can read and test: stackoverflow.com/questions/536676
I managed to do this on IE7/8 with the following Html:
<embed width="600" height="450" id="objMapView" src="http://XXXXXXXX/file.svgz"
type="image/svg+xml" name="objMapView" border="1"/>
It works Ok bur requires adobe's SVG Plugin

Firefox 3.0.7 is crashing when embedding a PDF using the object tag

I'm attempting to embed a PDF file into a HTML page using the object tag. The following HTML crashes Firefox 3.0.7:
<object id="pdfObject40" type="application/pdf" data="/file.ashx?id=40" width="432" height="600">
<param name="src" value="/file.ashx?id=40" />
</object>
I don't have a problem in Internet Explorer.
Check the MIME-type the ‘file.ashx’ script is returning. If it's something other than application/pdf, or Content-Disposition is getting sent, there might be wrinkles.
Otherwise, it can only be (a) something odd in the document — do other documents load OK? — or (b) your setup.
In any case I would personally avoid ever embedding a PDF in a web page. A PDF plugin is a pretty inconvenient way to view a document, and the Adobe Reader plugin in particular is both historically awfully unreliable in IE, and also an ongoing security disaster. I'm advising all my clients to uninstall it ASAP.
I ended up using that code for IE and failing over to a link with a about:blank in Firefox. If any has a solution, feel free to add. I'll accept it down the road.
Incase anyone else has this problem, I ended up using object element tag with Firefox and embed element tag with everything else.
I think if I'd not been serving the PDF through an .ashx I could have used the embed tag for everything.
See: http://blogs.adobe.com/pdfdevjunkie/2007/08/using_the_html_embed_tag_to_di.html