SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Dec 2005
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Remotely serving ads via Javascript

    Hey everyone,

    A client of mine wants to start an advertising system. Think Google Ads. The webmaster will simply get a chunk of Javascript to install on their web pages, which in turn, will dynamically display ads.

    I figured I'd just use AJAX to send a call to a PHP script on our server, but browser restrictions don't allow for this.

    Code:
    Security Error: Content at http://127.0.0.1/test.html may not load data from http://www.domain.com/display_ad.php.
    Error: uncaught exception: [Exception... "Access to restricted URI denied"  code: "1012" nsresult: "0x805303f4 (NS_ERROR_DOM_BAD_URI)"  location: "http://www.domain.com/ads.js Line: 26"]
    So I'm curious, how do people such as Google dynamically display ads on other sites with just Javascript? And if you're wondering, don't worry, this is all completely legit.

    Any help would be greatly appreciated!

    Matt

  2. #2
    SitePoint Zealot
    Join Date
    Dec 2005
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nevermind, got it! If anyone else ever hits this problem, excellent tutorial at:

    http://www.devarticles.com/c/a/JavaS...-with-the-DOM/

    Cheers,
    Matt


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •