Results 1 to 3 of 3

Thread: 'small' window target="_blank"

  1. #1
    Join Date
    Dec 2008
    Posts
    9
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default 'small' window target="_blank"

    is it possible to resize the target window, so that it doesn't fill the full screen, but comes up as a smaller screen.
    Last edited by djr33; 02-06-2010 at 08:09 PM.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    The thread you replied to is 3 years old and on a different topic (not to mention that it was posted in the wrong forum-- this is a javascript/html question, not PHP). You should always start a new thread for new questions unless you have a direct response to code or questions in an existing discussion. I have now separated this and closed the original thread.

    In response to your question, I do not believe there is any way to specify this in HTML alone. Using Javascript however, you can use a popup window script and specify everything you want. The problems: 1. some/most browsers block some popups-- some browsers block all popups. It might become a navigation issue with popup blockers becoming so strict lately. Usually the rule is that unmotivated popups are blocked and users clicking on a link (etc) generating a popup will have the popup appear. But this is not always the case, so be careful. 2. Even if the browser allows your popup, not all of its features may be implemented. But of the possible specifications, height and width are common and well supported. 3. This requires that your visitors are all using Javascript. To get around that, you can just have the regular backup available to them, using something like this:
    <a href="page.htm" target="_blank" onClick="return popup(this);">link</a>

    In other words: new window link, but if Javascript is enabled it will "return" only the popup when it's clicked-- the link function itself will be suppressed, so you don't end up with two new windows, but if Javascript is off the html only method will still work. This is crucial for compatibility.
    You could even do this:
    <a href="page.htm" target="_blank" onClick="if (popup(this)) { return true; }">link</a>

    That would check if the function popup() was successful: if so, return true (and skip 'returning' the real link); if not, nothing happens, so it will still do the regular link: that way if the popup is blocked it will probably still work for users. This isn't completely guaranteed though-- you should test it in a few browsers to be sure. Some browsers might handle it differently.


    As for specific code for generating a popup, just google it. Basically you are looking for "window.open" for Javascript.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Oct 2006
    Location
    New York, NY, USA
    Posts
    245
    Thanks
    39
    Thanked 24 Times in 24 Posts

    Default some POP scripts

    As is the case in most scripts, give your new window a name (other than "_blank") so you can talk to it. Otherwise, the new blank window opens the same size as the current window.

    Basically, set the window.open (url, "popName", "windowFeatures"). A script I've used for years at http://www.chanit.com/gallery/index.htm has more new window features than you might need.

    Code:
    <script language="JavaScript" type="text/javascript">
    <!-- // separate window for link 
    function myopen(url)
    { window.open (url, 'links', 'toolbar=0,location=1,directories=0,status=0,menubar=0,scrollbars=auto,resizable=yes,dependent=yes,width=400,height=400'); window.blur();
    }
    var links; //to avoid "undefined" message
    // JavaScript Unleashed's onUnload event handler
    function clean() { 
    if (links != null) { links.close() }; 
    } 
    // --> </SCRIPT>
    Then I call the function by name (myopen) in the link. <a href="javascript:myopen('http://www.dynamicdrive.com/forums/showthread.php?t=43787')">Dynamic Drive Forums</a>



    Another neat pop-up script used at http://www.jacquimorgan.com/hist/index.html and http://www.josephdenaro.com/gen/index.html is this one:

    Code:
    <script language="JavaScript" type="text/javascript">
    <!-- //Konithomimo at some forum ?
    var mypop=null;
    function loadpage(url) {
    if ((!mypop) || (mypop.close)) {
    mypop = window.open (url, 'mypop', 'width=400px,height=375px,toolbar=0,resizable=1,screenx=0,left=20,screeny=0,top=20');
    } else { mypop.document.location.href=url; }
    mypop.focus(); return true; 
    }
    // -->
    </script>
    Call function by name in link: <a href="#nogo" onclick="javascript:loadpage('j\image.jpg')">thum,bnail</a>

    Internet Explorer had been giving me trouble with the focus/blur for multiple references to the pop-up.

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
  •