+ Reply to Thread
Results 1 to 5 of 5

Thread: just how smart can an iframe get?

  1. #1
    bonzo meier is offline x10Hosting Member bonzo meier is an unknown quantity at this point
    Join Date
    Jan 2008
    Posts
    47

    just how smart can an iframe get?

    hi everybody,

    i am working on an idea on "intelligent" advertising right now, and i just came across the following:

    a document (letīs call it "ad.php") is placed on different websites via iframe, in the sense that www.thisisjust.com/an/example.html is showing ad.php in an iframe. these two are not on the same server.

    ad.php handles a couple of tracking-IDīs which makes traffic generated by this one specific ad.php recognizable as 'traffic-generated-on-www.thisisjust.com'. so if www.thisisjust.com owns the trackingID '1', it would actually call ad.php?trID=1).

    now hereīs my question: can ad.php BY ANY MEAN 'know' which site on www.thisisjust.com calls it?

    i mean, by checking the trID, ad.php knows that www.thisisjust.com is calling, but it can not know that it is being placed on the particular www.thisisjust.com/an/example.html. or can it?

    so my question (in other words) is: how can one get the complete url of a website through a document that is shown on that website in an iframe?

    scripting wizards apply! i will donor generously!

    peace, bonzo

  2. #2
    Thewinator is offline x10 Lieutenant Thewinator is an unknown quantity at this point
    Join Date
    Oct 2007
    Location
    [NL]
    Posts
    256

    Re: just how smart can an iframe get?

    If im not mistaking javascript can retrieve its parents url.
    Somewhere along the lines of

    var exampleSiteUrl = parent.href;

    You can pass this on with ajax or put in in a hidden field and refresh the iframe.



  3. #3
    Jober68 is offline x10Hosting Member Jober68 is an unknown quantity at this point
    Join Date
    Dec 2007
    Posts
    62

    Re: just how smart can an iframe get?

    Have you tried using a "requre" or "include" function and specifying the server? That may work even better than an Iframe if you are trying to get a php script out of it.

  4. #4
    Hazirak's Avatar
    Hazirak is offline x10 Sophmore Hazirak is an unknown quantity at this point
    Join Date
    Dec 2007
    Location
    Georgia
    Posts
    197

    Re: just how smart can an iframe get?

    To the best of my knowledge, the only way you could do this is to refer to ad's ID tag. As a security feature, a web page in an iframe that is from a different server than the page displaying it cannot access the properties of its parent, and vice versa.

    What you could do is use PHP in your ad to read out the page's ID using $_GET['trID'], then compare that ID with a list in a text file or an SQL database. From there the script could match that ID number up with its assigned site, then log it, email it to you, throw it on an internet billboard, or whatever you please.

    If for whatever reason PHP is out of the question, you could use Javascript to retrieve the name/value pairs, though this is a more complicated process - Javascript has no built-in methods for accessing stuff after the question mark in a URL. I did once do it though, and while I can't remember the exact method I used, what I did was search the URL for the name and recorded it in one array, and then took its value and recorded it in a second array with the same value... for example, in a url with "?view=23", "view" would be recorded in array1[0], and "23" would be recorded in array2[0].
    Last edited by Hazirak; 03-04-2008 at 05:02 PM.

  5. #5
    bonzo meier is offline x10Hosting Member bonzo meier is an unknown quantity at this point
    Join Date
    Jan 2008
    Posts
    47

    Re: just how smart can an iframe get?

    well i have been thinking about the javascript-parent.href-thing, but as hazirak says, this doesnīt work (i didnīt know it was for security reasons, though).

    unfortunately i do not have access to the showing pages (www.thisisjust.com in the example). it is just that a sourcecode of the iframe (with source and everything) is being passed to webmasters who are in the ad-program.

    but: as i am in the position to determine the source code that is being passed to the webmasters, i probably might as well write a javascript that
    a) reads the documentīs url (which it can, because it is pasted directly to the page by the webmaster)
    b) produces an iframe with the ad.php?url='www.thisisthecomplete.com/stuff/iwanna.php?var=get' in it.

    if i pass this javascript instead of the iframe-source code, is this supposed to work?

    @jober68: require/include will only work on php-sites, but these ads must run on plain .html, too

    peace, bonzo

+ Reply to Thread

Similar Threads

  1. Iframe
    By galaxyAbstractor in forum Graphics & Webdesign
    Replies: 2
    Last Post: 02-19-2008, 04:57 PM
  2. How smart are you IQ test
    By chaganlal1 in forum Off Topic
    Replies: 6
    Last Post: 07-08-2005, 01:32 PM
  3. iframe
    By Matthews255 in forum Scripts & 3rd Party Apps
    Replies: 9
    Last Post: 06-02-2005, 08:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers