1. This website uses cookies to improve service and provide a tailored user experience. By using this site, you agree to this use. See our Cookie Policy.
    Dismiss Notice

A little help with a joke.. (JS needs a tweek)

Discussion in 'HTML & JavaScript' started by SpongeR0b, Dec 10, 2019.

  1. SpongeR0b

    SpongeR0b Registered Member

    Joined:
    Nov 20, 2019
    Messages:
    77
    Likes Received:
    36
    So I'm experimenting a little with somebodies homepage.. rather than their browser actually loading up their usual homepage I've been experimenting with a replacement which looks like their usual homepage but with a twist!

    I've popped all the code into JSFiddle and it needs a quick tweek to get it working as intended.

    Basically I'd like to set a number of clicks (currently 2) before it opens another website in a new tab.

    https://jsfiddle.net/6g0Lavt4/

    Thanks in advance everybody, your assistance is appreciated
     
  2. Gnilly

    Gnilly Newbie

    Joined:
    Oct 13, 2019
    Messages:
    2
    Likes Received:
    0
    Gender:
    Male
    You can put a div over iframe, see here https://jsfiddle.net/paulalexandru/emj283d7/ (You can modify this example and make it transparent - css opacity:0)
     
  3. SpongeR0b

    SpongeR0b Registered Member

    Joined:
    Nov 20, 2019
    Messages:
    77
    Likes Received:
    36
    Thanks for your reply Gnilly and yes, using your example I could put a div over the top of the iframe however that's not really what i'm looking for unfortunately (unless I misunderstand?)

    The reason I titled this thread as a joke is because I'm trying to be mischievous, I want to create.. basically, a replica of somebodies homepage. Then even if they click on a link (on their homepage) the underlying page that is running the iframe is recording the number of mouse clicks. When the number of mouse clicks reaches a certain number (in this example, 2) the underlying page will automatically load up a different webpage in a new tab. Then as they click back on what they think is their homepage the counter will reset and continue to count, reopening the new tab again once two clicks have occurred.

    Hence the mischievous part because unless they type in a new url on the address bar they're probably not going to understand why a new page keeps opening and if it's a risque page that loads up whilst somebody is at work I would find this quite amusing myself..

    Any ideas please?
     
  4. SpongeR0b

    SpongeR0b Registered Member

    Joined:
    Nov 20, 2019
    Messages:
    77
    Likes Received:
    36
    OK, so answering this myself.. the iframe and it's containing page cannot and do not communicate with each other thus making this impossible in it's current form.. thanks anyway