Results 1 to 5 of 5

Thread: don't show modeless window address

  1. #1
    Join Date
    Nov 2006
    Location
    NW Vermont, (New England)
    Posts
    24
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default don't show modeless window address

    1) Script Title: Modeless Window

    2) Script URL (on DD):
    http://www.dynamicdrive.com/dynamici...odelesswin.htm

    3) Describe problem:
    It's not a problem. I want it NOT to display the URL in the title bar.

    I have a question about how to get rid of the URL in the title bar, or to substitute something else.
    Either one would be fine.

    I am using it to provide a small page with a question on it. (I'm a teacher and am developing a question / answer side bar which accompanies video lessons.)

    Here is all the code; I have only changed the page name for the link.

    Code:
    <script>
    
    //Modeless window script- By DynamicDrive.com
    //for full source code and terms of use
    //visit http://www.dynamicdrive.com
    
    function modelesswin(url,mwidth,mheight){
    if (document.all&&window.print) //if ie5
    eval('window.showModelessDialog(url,"","help:0;resizable:0;dialogWidth:'+mwidth+'px;dialogHeight:'+mheight+'px")')
    else
    eval('window.open(url,"","width='+mwidth+'px,height='+mheight+'px,resizable=1,scrollbars=0")')
    }
    
    //configure URL and window dimensions (width/height)
    modelesswin("question1.htm",200,200)
    
    //To load via link, use something like below:
    //<a href="javascript:modelesswin('http://yahoo.com',600,400)">Click here</a>
    </script>
    Thanks very much for any help!
    Last edited by jscheuer1; 05-20-2012 at 03:02 AM. Reason: Format

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,167
    Thanks
    44
    Thanked 3,240 Times in 3,201 Posts
    Blog Entries
    12

    Default

    Security built into every browser requires that a window show at least its base url. This is to prevent 'phishing' via the spoofing of another sites content. Like if you put up a page that looks like a bank's or PayPal's and ask the user to login, you could then garner their username, password and perhaps other sensitive data.

    Because of that fact, honest designers such as yourself cannot use the browser window to show content without it at least identifying its base URL.

    Most browsers show the complete address in an address bar that cannot be avoided, others just the base URL in an identifying bar that only appears when the address bar has been suppressed.

    When this script was first developed this was not the case and a window without any identifying information was possible. Even what is known as a completely chromeless window was possible. That was a window without any information or decoration other than a border.

    These sort of effects are still possible - sort of, but only with a pseudo window which is actually an absolutely position division from the launching page. Because of that it's not an independent window though. It cannot appear outside the borders of the launching page and ends when the launching page ends.

    If you want that sort of 'window', use Lightbox or a lightbox type script. Here's one that looks a lot like a real window:

    http://www.dynamicdrive.com/dynamici...ndow/index.htm

    and one where it just pops up the information:

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

    and something a bit more versatile but also more complex:

    http://fancybox.net/

    Scripts like these have their own limitations though as already mentioned, and others you may discover if you choose to use one. But they do afford some advantages over an actual window. But from your description it sounds like they might be a good fit for your purpose.
    Last edited by jscheuer1; 05-20-2012 at 03:11 AM. Reason: add a another script and details
    - John
    ________________________

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

  3. #3
    Join Date
    Nov 2006
    Location
    NW Vermont, (New England)
    Posts
    24
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default thanks and one more question

    John --
    Thanks so much for your informative answer. I did not know that about the URL. And, of course, it makes huge sense. And, I will still use what I am using now, simply because it works so well!

    To further impose on you, if I may ---

    I would really like to be able to tell the new window where to place itself. Is that
    possible?

    Thanks so much,
    Clair

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,167
    Thanks
    44
    Thanked 3,240 Times in 3,201 Posts
    Blog Entries
    12

    Default

    In IE it uses the showModelessDialog method which places the new window in the center of the user's screen. In all others it uses the open method, for which you may (using the modified script below) specify the top and left coordinates:

    Code:
    <script>
    
    //Modeless window script- By DynamicDrive.com
    //for full source code and terms of use
    //visit http://www.dynamicdrive.com
    
    function modelesswin(url,mwidth,mheight,mtop,mleft){
    if (window.showModelessDialog){ //if ie5
    window.showModelessDialog(url,"","help:0;resizable:0;dialogWidth:"+mwidth+"px;dialogHeight:"+mheight+"px");
    }
    else
    window.open(url,"","top="+mtop+",left="+mleft+",width="+mwidth+"px,height="+mheight+"px,resizable=1,scrollbars=0");
    }
    
    //To load via link, use something like below:
    //<a href="ext.htm" onclick="modelesswin(this.href,300,300,250,400);return false;">ext</a>
    </script>
    They are, for the example link 250 and 400 respectively, as highlighted above.

    If you want them all to be centered, that can be arranged, or if you want IE to use the open method too so that it will be positioned as set in the link code, that can be done too.

    Be aware that if you specify numbers for top and left, theses will be in relation to the user's screen. On larger screens it will be proportionately closer to the top and left, on smaller ones, farther. So much so on smaller screens that it might be too far to the right or bottom to be fully seen, or seen at all.

    For that kind of control, use:

    http://www.dynamicdrive.com/dynamicindex8/popwin.htm

    One odd man out for this in the browser world is Opera. It sees top and left differently than all others and dependent upon factors that cannot be read from it, so cannot really be relied upon to position a new window as desired. Often it still renders it 'in the neighborhood' though usually lower.

    Considering all that, it might be a good idea not to position it (use the original code). At least that way the browser will show the whole thing if at all possible.
    - John
    ________________________

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

  5. The Following User Says Thank You to jscheuer1 For This Useful Post:

    clair (05-22-2012)

  6. #5
    Join Date
    Nov 2006
    Location
    NW Vermont, (New England)
    Posts
    24
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Thanks again John -- I'm pretty proficient in CSS and HTML, but sadly lacking in JS. I've not found the language to be a good match with me. (I'm much happier with PHP and recently Python.)

    My presentation at the Academic Retreat is the day after tomorrow, and this issue was bugging me. My summer project will be an attempt at a whole UI within a broswer window for playing teaching videos accompanied by question/answer sections. Along the lines of the courses taught at udacity.com.

    Again, I thank you so much for your help and advice. (I don't know how to mark this solved. Maybe I'm too junior. -- But if you can do it, please do so!)

    Later: John, I could not get the original window to resize at all. So, I looked at your other suggestions and tried the last one--popwin-- and that worked.

    After all your help, I thought you might like to see. The video there is just a placeholder and the questions are just sample questions for coding purposes. I'm just flashing this on the screen near the end of my presentation to show them what I will be working on for the summer. Only the questions under Unit 1 are activated at this point.

    http://www.borderlinegeek.com/vsc-browser/index5.html

    (The one that didn't work is index4.html)

    Clair
    Last edited by clair; 05-22-2012 at 11:12 AM. Reason: asked John to mark this solved. added link

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
  •