Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Mar 2004
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question HARD ONE! window.open - Where's it go?

    Im modifing an old version of ultrabar. Its an IE toolbar with customizable search engines. (better then google bar IMO)

    Someone added a button to open non active urls by selecting (highlighting) them. It opens the url good but in the same window, I want to make them open in a new window.

    Can someone Please help me
    Give me some Ideas or mabey test it yourself if you have the time.
    I know very little about javascript. Im using Resource hacker to edit the javascript in the Dll file. Its String 8, line 113.

    Do I use window.open and how should it look?


    javascript:q=(document.frames.length?'':document.selection.createRange().text);for(i=0;i<document.fr ames.length;i++){q=document.frames[i].document.selection.createRange().text;if(q!='')break;}if(q=='')void(alert('Nothing was selected. Please select an URL on the page. '));if(q!=''){if(q.substr(0,7)!=\"http://\"){parent.document.location.href=\"http://\"+q;}else{parent.document.location.href=q;}location.href=q}

    Thanks a million if someone can help solve this, Ive been at it a week.

    The toolbar .Rar
    h**p://www33.brinkster.com/ricecrispies
    Last edited by ghoulardi; 03-19-2004 at 03:32 AM.

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Did you add the last statement location.href=q? If yes, then remove it.

    Then change
    Code:
    if(q!=''){
     if(q.substr(0,7)!=\"http://\"){
       parent.document.location.href=\"http://\"+q;
     }
     else{
       parent.document.location.href=q;
     }
    }
    to
    Code:
    if(q!=''){
     if(q.substr(0,7)!=\"http://\"){
       window.open(\"http://\"+q, "_blank");
     }
     else{
       window.open(q, "_blank");
     }
    }
    I put the code in newlines for readability's sake.
    Last edited by glenngv; 03-19-2004 at 04:17 AM.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    New Coder
    Join Date
    Mar 2004
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry I must have some how messed it up during copy/paste.
    This is exactly how it looks

    javascript:q=(document.frames.length?'':document.selection.createRange().text);for(i=0;i<document.fr ames.length;i++){q=document.frames[i].document.selection.createRange().text;if(q!='')break;}if(q=='')void(alert('Nothing was selected. Please select an URL on the page. '));if(q!=''){if(q.substr(0,7)!=\"http://\"){parent.document.location.href=\"http://\"+q;}else{parent.document.location.href=q;}}

    This is what I tried from what you wrote

    java script:q=(document.frames.length?'':document.selection.createRange().text);for(i=0;i<document.frames .length;i++){q=document.frames[i].document.selection.createRange().text;if(q!='')break;}if(q=='')void(alert('Nothing was selected. Please select an URL on the page. '));if(q!=''){if(q.substr(0,7)!=\"http://\"){window.open(\"http://\"+q, "_blank");}else{window.open(q, "_blank");}}

    The problem is that
    Resource hacker is giving errors and wont let me compile it.

    example
    "Compiler Error in line 6 at offset 351
    Invalid statement: End of line expected"

    I think it is refering to the qoutes around "_blank"
    I have no idea why??? though.

    I really apreciate your help Thank you !!!!!!!
    If you dont want to mess with it anymore I dont blame you..

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Use single quotes instead

    '_blank'
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •