SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Member
    Join Date
    Aug 2011
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile Open new window in IE8 instead of new tab

    Code:
    d='javascript:if(document.getElementsByTagName("*").length>0&&document.getElementsByTagName("body")[0].innerHTML!=""&&!confirm("You are about to navigate to home page Do you want to do that ? ")){opener.display2WindowHelp();}else{window.location.replace("${pageContext.request.scheme}://${pageContext.request.serverName}:${pageContext.request.serverPort}${pageContext.request.contextPath}'+d+'");}';
    
    b= window.open(d,"_spor_window_"+a+window.location.hostname.replace(/\./g,""),"menubar=no,scrollbars=yes,height="+screen.availHeight+",width="+screen.availWidth+",left=0,top=0,resizable=yes,toolbar=no,location=no,status=no");
    I wrote the above code to open a new window from home window . but its opening a new tab in IE8 . Is there a way to modify this to open a new window instead of new tab in IE8

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by mani214 View Post
    I wrote the above code to open a new window from home window . but its opening a new tab in IE8 . Is there a way to modify this to open a new window instead of new tab in IE8
    The only guaranteed way is to change the web browser's new window settings, which can only be done by the person using the web browser.

    It is possible to open in a new window by specifying a width/height for the window, but there's no guarantee all web browsers will behave that way.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Member
    Join Date
    Aug 2011
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by paul_wilkins View Post
    The only guaranteed way is to change the web browser's new window settings, which can only be done by the person using the web browser.

    It is possible to open in a new window by specifying a width/height for the window, but there's no guarantee all web browsers will behave that way.

    I agree but a different code is opening a new browser window in the same browser but this is not able to do that .. i think i can modify my code to do so ...thanks

  4. #4
    SitePoint Member
    Join Date
    May 2011
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mani214 View Post
    I wrote the above code to open a new window from home window . but its opening a new tab in IE8 . Is there a way to modify this to open a new window instead of new tab in IE8
    As a web surfer I find it very annoying when some website wants to open a new window in general. I consider it very spammy and think x2 about visiting sites like that again.

    New tabs however, I'm ok with. I'd suggest you just stick with new tab.

  5. #5
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,788
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Where new web pages open is completely under the control of your visitor. The days when the web page author could force pages to open in a new window ended long before browsers introduced tabs - that's why no option for opening a new tab was introduced into JavaScript.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  6. #6
    SitePoint Member
    Join Date
    Aug 2011
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    Where new web pages open is completely under the control of your visitor. The days when the web page author could force pages to open in a new window ended long before browsers introduced tabs - that's why no option for opening a new tab was introduced into JavaScript.
    it still works in IE8 i guess the problem is with the javascript that i assigned to the variable if i give a url in place of script it holds good and working fine i need to figure out a way for this .. any how thanks for your help

  7. #7
    SitePoint Member
    Join Date
    Aug 2011
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AgentHomes View Post
    As a web surfer I find it very annoying when some website wants to open a new window in general. I consider it very spammy and think x2 about visiting sites like that again.

    New tabs however, I'm ok with. I'd suggest you just stick with new tab.
    this is for internal use and we need to do this for our app thanks for ur comment.

  8. #8
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,788
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by mani214 View Post
    this is for internal use and we need to do this for our app thanks for ur comment.
    So you need to configure each copy of the browser to always open pages that request it in a new window. Of course that will then apply to requests from all web sites and not just your internal one.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


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
  •