SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Thread: LinkUp

  1. #1
    SitePoint Wizard silver trophy
    Join Date
    May 2003
    Posts
    1,843
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    LinkUp

    Continued from here. Just in case anyone is looking for a DOM-based method of opening popups from links. Knocked off these demos (from Al Franken's "Liars..." book & www.theonion.com) pretty quickly, so: it's easy to implement. Suggestions welcome.

    adis

    Edit:

    4/15/04: upgraded, now does sized image windows...

    Edit:

    4/18/04: upgraded, more OO, global event handling...
    Last edited by adios; Apr 30, 2004 at 12:25.
    ::: certified wild guess :::

  2. #2
    SitePoint Zealot jrickards's Avatar
    Join Date
    May 2003
    Location
    Sudbury
    Posts
    131
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, I have the beginnings of an article on my site about this code. I also have been able to apply customizations to it with relative ease. Regarding my "wishlist" of allowing the user of this code to choose their own classname, I noticed you had already implemented that idea (just like the AnyBrowser campaign, Best Viewed with Eyes Open, idiot). I made a minor change to the code where I changed span.className = "LU"; to span.className = sLinkClass; which is the variable that stores the "trigger" class name. This I felt would be easier to style rather than having to remember two classnames.

    The Opera 7.23 issues still exist with your latest code release. I downloaded Opera 7.5b4 (released today) and it behaves the same as Opera 7.23. You might want to examine the code that Caio Chassot wrote for his article to see how he resolved it because his popups work fine in Opera but don't have the features you have in yours.

  3. #3
    SitePoint Zealot jrickards's Avatar
    Join Date
    May 2003
    Location
    Sudbury
    Posts
    131
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Interestingly enough, there is an article on Digital-Web.com that deals with some of what you, Adios, have done in this script. You might want to read http://digital-web.com/columns/keepi...tructure.shtml.

  4. #4
    SitePoint Zealot jrickards's Avatar
    Join Date
    May 2003
    Location
    Sudbury
    Posts
    131
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Two things I learned from Peter-Paul Koch's site which I checked out last night.

    Regarding the code:
    Code:
    var W3CDOM = (document.createElement && document.getElementsByTagName);
    
    window.onload = init;
    
    function init()
    {
    if (!W3CDOM) return;
    ...
    The first line and last lines in this snippet check to see if the browser supports W3CDOM which is a requirement for his scripts and should be for yours too.

    Secondly, rather than insert the onload trigger in the body of the page, he inserts it into the external script.

    Both of these things improve the script and can be applied to LinkUp too.

  5. #5
    SitePoint Wizard silver trophy
    Join Date
    May 2003
    Posts
    1,843
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yet another revision... (see above)

    Interesting blog, this seems to be popular. Nice animated arrow! Not so nice: viewing in MSIE.
    Last edited by adios; Apr 18, 2004 at 16:33.
    ::: certified wild guess :::

  6. #6
    SitePoint Zealot jrickards's Avatar
    Join Date
    May 2003
    Location
    Sudbury
    Posts
    131
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, I have learned what the problem with Opera is and I suspect that there is nothing that can be done about it: however, I will post a message if there is something.

    I put out some messages at various forums and here are some responses I received:
    The only time you ever have permissions issues in javascript is when communicating between frame objects, between window objects, or between document objects.

    You can control any window which your document creates. But you cannot control the document in that window unless it is in the same domain as the document that created it.

    It is my theory that Opera is denying access to something in the document or window becuase you are loading a different domains document into your pop-up. I think opera is just more "paranoid" than ie.
    and, in this quote, the person is refering to the error message in the console window:
    that always indicate that you are trying to access either a sort of frame or a window, wich has a different source then the current document. opera does not allow to merge local and online source in any way, it is actually very strict about that.
    Essentially, Opera has a stricter permissions scheme than most browsers, if not all other browsers. I don't know where this script is exerting control over another window appears in your script but perhaps the change of focus (I'm still testing the script two previous versions before your most current one). If so, is there any way to make the focus optional?

    However, that adds another feature which I am reluctant to do. I could just create a notice that Opera behaves differently when opening a page from another domain. But if you want to pursue it, here is an idea. If we add another configuration option such as:

    LU_HomeDomain = 'http://jrickards.ca';

    and then later in the script, when a popup is triggered, the function checks to see if the href begins with http, if so, is it different than the LU_HomeDomain, if so, don't force focus. You could add another option such as:

    LU_ForceFocus = true; // or false

    and if it is true, then check the LU_HomeDomain, if false, then don't bother because the focus will not be forced on any link. This adds flexibility so that if the person using the script wishes to open pages from other domains and they know that Opera users are going to view their page or just want to accomodate them, then they can set the LU_ForceFocus to false. However, if they know that their visitors will not be using Opera (for example, IE on an intranet) or none of their popups will open pages from other domains, then they can set LU_ForceFocus to true.

    Another possible method would be to provide three LU_ForceFocus options: none, internal and all. None means that LU_ForceFocus will never be employed. Internal means that LU_ForceFocus will only be employed if the popup destination is of the same domain. All means that LU_ForceFocus will always occur. The Internal option would require the LU_HomeDomain configuration but the other two wouldn't matter.

    Other than that, it appears that there may be no fix.
    Last edited by jrickards; Apr 19, 2004 at 09:53.

  7. #7
    SitePoint Wizard silver trophy
    Join Date
    May 2003
    Posts
    1,843
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Back w/more. Starting to like this concept.

    Comments, suggestions, threats encouraged. Demo 1 rated PG.

    [zip coming below]
    Last edited by adios; Apr 30, 2004 at 12:25.
    ::: certified wild guess :::

  8. #8
    SitePoint Wizard silver trophy
    Join Date
    May 2003
    Posts
    1,843
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is not a bump. Bumping is wrong.

    Those who sacked the people responsible for bumping this have been sacked, and wish it to be known that they have just been sacked.

    zip available this fall
    Attached Files Attached Files
    ::: certified wild guess :::


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
  •