1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Need Some one who knows how to block pop ups.

Discussion in 'PHP & Perl' started by rettaibi, Aug 9, 2012.

  1. rettaibi

    rettaibi Regular Member

    Jun 25, 2012
    Likes Received:

    I have a website that has iframes in it, the iframe goes to a website but the website has pop-up and that is pretty annoying is there any script or something else that can block the pop-ups.

    Hope someone could help me

  2. jazzc

    jazzc Moderator Staff Member Moderator Jr. VIP

    Jan 27, 2009
    Likes Received:
    No, you can't affect iframed sites from your site.
    • Thanks Thanks x 1
  3. loki_

    loki_ Registered Member

    May 20, 2012
    Likes Received:
    the only way to do this is to get the actual contents of the iframe with curl for example and output those instead of the live page and then strip off the javascript. The problem here however is the fact that you are not iframing the actual page.
    • Thanks Thanks x 1
  4. derzok

    derzok Newbie

    Aug 11, 2012
    Likes Received:
    Exactly! iframes are really just a call to the browser saying "hey, get this webpage and display it here." If you wanted to do what you mentioned, you would need to write code on your end to grab the page and then display it to the user (like loki said).

    The reason you can't do this is because most browsers have controls to separate the DOM coming from an iframe to prevent cross site scripting (XSS). Think about it this way: if the inner frame could be controlled by the outer frame, the opposite would also be possible. And if the outer frame can be controlled from the inner frame (using JS or something) the owner of the iframe site could include malicious code that could steal cookies from the outer frame - as an example.

    If you explain to us why exactly you're trying to put another site in an iframe, we might be able to help by providing an alternate solution to your problem.

    And before anyone else says it: use a modern browser :p Most modern browsers are able to block popups. I think adblockplus works on just about every major browser available...