Forum Moderators: phranque

Message Too Old, No Replies

embedding external html page into a blog?

         

dickbaker

4:06 pm on Apr 25, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've created an interactive chart that I'm trying to get other sites to link to. On forums related to my niche, forum members are asking for the code required to embed my html page with the chart into their blogs. Problem is, I don't know how to do that.

It seems to me that a simple link with a target="_blank" should be sufficient, but they want the whole interactive chart on their blog page. The chart is composed of several image files, and is controlled by a fair amount of javascript, so giving them the source code wouldn't work.

Is there any way to do this?

Thanks in advance for any replies.

rocknbil

5:37 pm on Apr 25, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



and is controlled by a fair amount of javascript, so giving them the source code wouldn't work.

How about

<script type="text/javascript" src="http://example.com/yourscript.js"></script>

Where example.com is your site?

You would only have to

- make sure the JS is 100% contained in the external file
- make sure all image references in the Javascript use full URL's to the images, not relative paths.

Look at what Google and others are doing with JS - you could even pass parameters to your script and track usage, format sizes, etc. Think adSense. Same idea.

phranque

9:40 pm on Apr 25, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Inline frames [w3.org]

dickbaker

4:22 pm on Apr 26, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks for the replies. I tried the inline frames, but I probably didn't understand what I was doing, as it didn't work in either of the two blogs I tested in.

As for providing absolute URLs to the javascript and image files, as well as all of the html, I don't think that would work for the blogs. The interactive chart is made up of layers with absolute positions. I expect that the arrangement of the layers would be completely messed up if posted in a blog.

If I can't figure out how to do this with the html file, I'll have to recreate the chart in Flash. A lot of screwing around, but maybe that's the only way.

All I'm looking for is links, and I've created a unique bit of content to link to. Sheesh.

phranque

1:27 am on Apr 27, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



I tried the inline frames, but I probably didn't understand what I was doing, as it didn't work in either of the two blogs I tested in.

what happened when you tried inline frames?
are you able to display just the page referred to by the href attribute of the iframe tag?
did you provide alternate content in the iframe tag in case the blogs have frames disabled?

dickbaker

3:45 pm on Apr 27, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Phranque, when I tried it, the only thing I saw in the blog post was the code. Here's what I wrote in the blog post (actual URL changed, of course):

<IFRAME src="http://www.example.com/chart.html" width="1050" height="1050"
scrolling="auto" frameborder="1">
[Your user agent does not support frames or is currently configured
not to display frames. However, you may visit
<A href="http://www.example.com/chart.html">the related document.</A>]
</IFRAME>

Is there something more that I should be adding? Sorry to sound so stupid, but I'm not a coder.

phranque

8:52 pm on Apr 27, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



are you saying it renders the frame and then within the frame it displays the html code contained in http://www.example.com/chart.html?

what happens when you directly view http://www.example.com/chart.html in your browser?
what content-type header is returned when you request http://www.example.com/chart.html?

dickbaker

10:45 pm on Apr 27, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No, the code displayed in the blog is the Iframe code in my post above. There's no frames, no nothing. Just the lines of Iframe code.

The header for the real chart.html page is <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

phranque

11:01 pm on Apr 27, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



No, the code displayed in the blog is the Iframe code in my post above. There's no frames, no nothing. Just the lines of Iframe code.

that probably means the blogging platform doesn't support iframes and is probably escaping those tags.
are you using a blog cms or a hosted blog solution?
this would be expected if your blog is hosted.

The header for the real chart.html page is <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

that is a doctype declaration, not a content type header.
i'm assuming http://www.example.com/chart.html displays correctly in your browser.

dickbaker

5:13 am on Apr 28, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I tried it on a couple of blogs. One was hosted by a forum and another was the blog related to Google (forget the name, I'm really tired tonight).

Since I'm doing this to get links, blogs aren't the #1 venues I'd go after anyway. I'd much rather find an economics site whose owner is interested in providing the site's users with a link to the interactive chart.