SitePoint Sponsor

User Tag List

Results 1 to 18 of 18
  1. #1
    SitePoint Addict
    Join Date
    Jun 2002
    Posts
    240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    override popup script

    Can someone tell me if this idea is possible? My web host forces pop up ads to show up on my sites (my web host is the corporate IT dept). They do this since I have to utilize the corporate template. Anyway, can anyone think of a PHP script that I could put on each page to override or kill the popup ad before it shows up on each page? Thanks.

  2. #2
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Just find which .js src file contains the popup mechanism; copy it to your local path; alter your pages to look at the local rather than remote path for this file; comment out the popup code in your local copy of the src file; sit back - look smug then wait to be called into your boss's office for a dressing-down and be put on report for misconduct.

    This has nothing to do with PHP.

    Caveat: I am assuming that the template uses .js src files to create the layers etc. as my company's intranet templates are similarly configured.
    Ian Anderson
    www.siteguru.co.uk

  3. #3
    SitePoint Addict
    Join Date
    Jun 2002
    Posts
    240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, that's just the thing. I can't alter the pages to look at the local. The corporate guys at our server farm far away control the popups and adservers and I can't change them. That's why I was hoping to write a PHP script to kill any popup windows that originate from the page.

  4. #4
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Use the latest Netscape or Opera browser - IIRC they contain a feature to disable popup ads. Otherwise turn off JavaScript in your browser.
    Ian Anderson
    www.siteguru.co.uk

  5. #5
    SitePoint Enthusiast
    Join Date
    Dec 2002
    Location
    Dewsbury, UK
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If the code is at the top of the page then this post is no help to you, but if its at the bottom the following may be of help:

    <?php
    exit;
    ?>


    Although you shoudn't be asking this kind of stuff, and I shouldn't be replying !
    piniyini = the wackiness crazed within
    Check out my blog => toseef's blog

  6. #6
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    If you don't have access to the actual website pages to be able to alter any code (ref. my previous suggestion), then the above tip won't help.
    Ian Anderson
    www.siteguru.co.uk

  7. #7
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You should be able to achieve this with JavaScript, not PHP, as this is something that will have to be done on the client, once the html page has been generated. If it is OK, I will move this to the javascript forum, as I am sure that with a bit of crafty js, you should be able to close any child windows from your page; and the good javascript gurus in the JS forum will know how

  8. #8
    SitePoint Addict
    Join Date
    Jun 2002
    Posts
    240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, I was thinking about this in depth last night and I realized that it would have to be done on the client side. Maybe the Javascript gods can be of assistance.

  9. #9
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Originally posted by ian0502
    Yeah, I was thinking about this in depth last night and I realized that it would have to be done on the client side. Maybe the Javascript gods can be of assistance.
    window.onload = null;

    Maybe that will help?

    --Vinnie

  10. #10
    SitePoint Addict
    Join Date
    Jun 2002
    Posts
    240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, I'll try that out. Does that need to be in the <head> section or does it need to be in the <body>? I really don't know too much client-side scripting.

  11. #11
    SitePoint Addict
    Join Date
    Jun 2002
    Posts
    240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nope, it didn't work. Any other ideas?

  12. #12
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    So ... you do have access to the HTML coding of the pages then. You are simply using default templates, yes?

    Then I don't see how my earlier suggestion (copying the js src files, and updating the HTML of the template to point to the local rather than remote src files) can't be done?
    Ian Anderson
    www.siteguru.co.uk

  13. #13
    SitePoint Addict
    Join Date
    Jun 2002
    Posts
    240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have access to files that get inserted into a content management system. I can't control the files that make up the CMS such as the JavaScript files. Any ideas?

  14. #14
    SitePoint Zealot
    Join Date
    Oct 2001
    Location
    Montreal, Canada
    Posts
    169
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you look at the source of the page once it's loaded in the browser, i'm pretty sure you'll either find the code at the end of the page or in an external js file. My guess is that the server adds the code before sending the page to the browser. This may not do the trick: create a function to kill the window in the head section and call it at the end of your code with the setTimeout js method, let's say like this:

    Code:
    <script type="javascript">
    setTimeout('killpopup()', 100)
    // for the miliseconds parameter, you'll have to try which is better
    </script>
    For the closing code itself, I'll leave to you to discover, because for this to work, you'll have to use the close() method and the close() method works only with windows opened with the open() method, so you need to have access to the js source code.

    Hops that helps a bite.

    Michel
    Dis donc, qu'est-ce qu'il dit ce mec? Hein? Je comprends rien...

  15. #15
    SitePoint Enthusiast
    Join Date
    Dec 2002
    Location
    Dewsbury, UK
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe if you told us the URL of the page we could help you out by providing you with some sort of script ?

    Just a thought.
    piniyini = the wackiness crazed within
    Check out my blog => toseef's blog

  16. #16
    SitePoint Addict
    Join Date
    Jun 2002
    Posts
    240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I work for a group of radio stations that all use the same basic CMS. Here's an URL to one of the sites that are plagued by the annoying and everpresent popups: http://www.961therocket.com

  17. #17
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    you want to get rid of adverts?

    Is it the adverts you want to get rid of?

    You could create a div of z-index higher than adverts(try 100), and position it over the adverts. It looks as if your program uses an external .js to build the main content, so your HTML document gets added to it.

    if you position everything in a div placed absolutely at 0,0, then close the div at the end of your document, it should work.

    If it doesn't, they might still have some open divisions, so start your document with </div>

    hope you have luck
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  18. #18
    SitePoint Addict
    Join Date
    Jun 2002
    Posts
    240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, I want to get rid of those advertisements. Thanks for the help, I'll try your suggestion.


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
  •