Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Context Menu Iframe won't work!

  1. #1
    Join Date
    Oct 2004
    Posts
    79
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Context Menu Iframe won't work!

    http://www.dynamicdrive.com/dynamici...ontextmenu.htm

    With this nice script, when I put a iframe has target, it won't work.


    <SCRIPT language=JavaScript>
    <!--

    function SymError()
    {
    return true;
    }

    window.onerror = SymError;

    var SymRealWinOpen = window.open;

    function SymWinOpen(url, name, attributes)
    {
    return (new Object());
    }

    window.open = SymWinOpen;

    //-->
    </SCRIPT>
    This piece of code causes the problem, but it's necessary for another script...
    How can I do this now?

    Greetz
    Last edited by Gabber; 07-07-2005 at 06:02 PM.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Which script requires this? It looks to me to just be standard error- and window-muffling code.
    Comment it out and try everything.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by Gabber
    With this nice script, when I put a iframe has target, it won't work
    The window.open() method targets a new or existing window. If you want to target a frame or iframe, do it by its name, id or any method of identifying it via javascript script, using the location.href=, location.href.replace() or src= methods. Or use a regular link with the target attribute set to the frame/iframe's name.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    Oct 2004
    Posts
    79
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Jscheuer1 - Well, I tried all those methods... none works in the script I mentioned above (see link).

    Twey - the script is one that says the time on page... so it needs load and unload elements... IF I take the whole thing, it won't work. :\

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    They will all work in any script, if written correctly and used for what they will do. Let's see your full code or:

    PLEASE: Include the URL to your problematic webpage that you want help with.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Oct 2004
    Posts
    79
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question

    The page has a lot of scripts... all work (except sound in FF).

    1- I took a line of the script I posted... and it worked fine offline.

    2- I upload, and see the page online. Does not work. Why? My host adds 2 scripts, one after the body (!) and other in the middle of the html... it's exactly the same as I pasted above.... so even if I have that script without the line that causes the problem... it has another duplicate with that line...

    hence... stuff does not work!
    Is there a way my host won't add anything?

    url:

    http://gabber.no.sapo.pt/indexframe.htm


    Thanks for the help

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I'm still not clear on what it is that you want to have happen and when. Also, are you now saying that the iframe gets targeted after all, just not live due to conflicts with your host's scripts?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  8. #8
    Join Date
    Oct 2004
    Posts
    79
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    see the source of that link.
    I changed this:

    <SCRIPT language=JavaScript>
    <!--

    function SymError()
    {
    return true;
    }

    window.onerror = SymError;

    var SymRealWinOpen = window.open;

    function SymWinOpen(url, name, attributes)
    {
    return (new Object());
    }

    window.open = SymWinOpen;

    //-->
    </SCRIPT>
    into

    <SCRIPT language=JavaScript>
    <!--

    function SymError()
    {
    return true;
    }

    window.onerror = SymError;

    var SymRealWinOpen = window.open;

    function SymWinOpen(url, name, attributes)
    {
    return (new Object());
    }


    //-->
    </SCRIPT>

    and stuff worked again in my pc... So I basically did a small fix...
    but I dunno how, the place here I have my files hosted adds 2 script, including this one again!

    <SCRIPT language=JavaScript>
    <!--

    function SymError()
    {
    return true;
    }

    window.onerror = SymError;

    var SymRealWinOpen = window.open;

    function SymWinOpen(url, name, attributes)
    {
    return (new Object());
    }

    window.open = SymWinOpen;

    //-->
    </SCRIPT>
    now how do I work this out?

  9. #9
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Give your script all different names for the variables and functions so that it will not conflict with the host's script. Then when you make calls to it, use the new name. Then the host's script can sit idly by while yours operates.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  10. #10
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    All you did to that page was disable the no-window-opening code. You now have a function (SymWinOpen()) which isn't ever going to be called.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •