Forum Moderators: open

Message Too Old, No Replies

Javascript Equivalent for IFrame

Displaying content on a website from another website

         

israr

12:24 pm on May 22, 2008 (gmt 0)

10+ Year Member



Hello all,

There are some sites which let user the option of copy and paste some code from their site to display content of their websites, on other sites. Like google does in their adsense ads or Rss content provider websites.

By using IFrames you can do it. But it can also be done using javascript, like:

<script language='javascript' src='http://www.any-test-site.com/abc.html'></script>

How could I implement this functionality in a website. Any help?

httpwebwitch

1:11 pm on May 22, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hi israr, welcome to WebmasterWorld!

When you "hotlink" a script from another domain, you're just giving them carte blanche to execute script on your page. That script could be anything, from a bunch of document.write()s, to a complex AJAX application. It could even be malware like a keylogger or authentication hack.

In the case of Adsense, their script writes an iframe onto your page and fills that with rendered ads. It may seem mysterious because all the scripting is hidden and unobtrusive, but it's actually *very* simple to do.

Are you seeking to publish your content on other sites, or publish other's content on yours?

StoutFiles

1:17 pm on May 22, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm confused on what you're asking...you want the javascript solution?

I believe iframing is better than javascript, some browsers will have javascript turned off.

israr

2:32 pm on May 22, 2008 (gmt 0)

10+ Year Member



Sorry I didn't described the whole problem. So here is my problem:
I have website which provides rss based ticker headlines news to client sites. e.g. a marquee running in iframe displaying news from my site. So when user's mouse rolls over a news link the description part of rss is shown as a tooltip.

The problem is because the iframe's length is smaller vertically for marquee, only part of description thats inside the iframe page is shown the rest of the part(that goes beyond the iframe to the client site) is hidden.
So I was wondering there is a way to display another website content without using IFrame.

By the way this is fifth forum where I have posted my problem in last two days, and not a single reply from atleast fifty views. So thanks alot Webmasterworld, httpwebwitch(your adsense description did helped understanding the concept), StoutFiles.

httpwebwitch

11:48 pm on May 22, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



WebmasterWorld has a fast uptake and extremely high participation. That's what keeps people coming back!

I think your answer is simple...
Let your clients put a hotlinked script on their sites. It'll look like this:

<script src="http://ww.example.com/yourscript.js"></script>

choose the URL wisely. It must be a permanent location, since you can't go into other people's sites to make changes later!

Then create the JS file and host it on your server.
your JS file could be just a few document.write commands, to inject HTML and scripting into the recipient's DOM.

israr

4:25 pm on May 23, 2008 (gmt 0)

10+ Year Member



Problem solved! Thanks
It *is* very simple to achieve

httpwebwitch

4:48 pm on May 23, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You're welcome israr. Glad to have you aboard.
Please browse around some of the other forums, too!
Cheers