Opening url link in new window

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
apbristow
Beginner
Beginner
Posts: 2
Joined: Sat Dec 10, 2005 8:35 pm

Opening url link in new window

Post by apbristow »

I may be missing something but I simply cannot get a URL link to open a new window?

I am using syntax

aI("image=example.gif;text=Example;url=https://www.example.co.uk;target=new");

Can anyone advise what I am doing wrong.

Andy
apbristow
Beginner
Beginner
Posts: 2
Joined: Sat Dec 10, 2005 8:35 pm

More info

Post by apbristow »

Sorry - should also have added that I am using a licensed/registered version of Menu Milonic style Sample 78 Ver 5.736.
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

It's been reported and I'm sure Milonic is working since they work pretty quickly to fix any bugs.

Ruth
Shap5202
Super Advanced
Super Advanced
Posts: 62
Joined: Thu Sep 29, 2005 2:36 pm

Post by Shap5202 »

I apologize in advance if this is something you know and just didn't want to do, but I didnt know the background :)

You could always just do the open in a new window yourself if you don't want to wait for a fix.

Just add a javascript method to your html

Code: Select all

<script>
function openWindow(url){
        window.open(url);
}
</script>
again, if my post is pointless for you.. please disregard... just didnt have anything better to do on a tuesday night :)
along with

Code: Select all

aI("image=example.gif;text=Example;url=javascript:openWindow('https://www.example.co.uk');"); 
jencam
Advanced
Advanced
Posts: 12
Joined: Fri Dec 16, 2005 1:07 pm
Location: Melbourne
Contact:

Post by jencam »

I tried that javascript with the code also and it didn't work. If I add the javascript to a page won't it open every page in a new window when you might not want it to?
User avatar
bobwill
Mega Advanced
Mega Advanced
Posts: 229
Joined: Tue Oct 01, 2002 3:03 pm
Location: Kansas
Contact:

Post by bobwill »

I thought syntax was target='new' or target=_new. I used target=_blank using lates version of menu and it works fine...
jencam
Advanced
Advanced
Posts: 12
Joined: Fri Dec 16, 2005 1:07 pm
Location: Melbourne
Contact:

Post by jencam »

Great. Can you explain how it goes?

Like we have

Code: Select all

aI("text=Domains and hosting;url=http://www.ozhub.com;"); 
Can you tell me how to put the _blank in? I've tried it and it didn't work.
User avatar
bobwill
Mega Advanced
Mega Advanced
Posts: 229
Joined: Tue Oct 01, 2002 3:03 pm
Location: Kansas
Contact:

Post by bobwill »

Here is an example:

aI("text=Birth Certificate Search;url=http://www.vitalchek.com/;target=_blank;status=Order a Birth Certificate;separatorsize=1;");

Make sure that you do not put a space after the "target=", just all one word. "target=_blank"

Hope this helps...
jencam
Advanced
Advanced
Posts: 12
Joined: Fri Dec 16, 2005 1:07 pm
Location: Melbourne
Contact:

Post by jencam »

Yeah that worked. Brilliant. Thanks a heap.
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

The newest version [pre-release at this point, 5.737] has fixed the open a new window problem I believe.

As to using a function to open a new window:

Code: Select all

var newwindow; 
function poptastic(url) 
{ 
   newwindow=window.open(url,'name','height=500,width=400,left=100, 
  top=100,resizable=yes,scrollbars=yes,toolbar=yes,status=yes'); 

} 
If you put the function into the menu_data.js file and call it from particular links, it will only open that page in a new window. I'm using the one above because it's one I've used before. You would put that at the top of you menu_data.js file, note there are no script tags. Then in the aI strng you'd code it as

Code: Select all

aI("text=item;url=javascript:poptastic('http://whatever/');");
Note that I"ve put the window features into the function so you wouldn't use targetfeatures= in the aI, also note that not all browsers will accept all the features, for example, some will not read top= and left= and allow you to position the window.

For information on target features check this site
http://www.devguru.com/Technologies/ecm ... _open.html

Ruth
jencam
Advanced
Advanced
Posts: 12
Joined: Fri Dec 16, 2005 1:07 pm
Location: Melbourne
Contact:

Post by jencam »

Hi,
I've found the way I did it worked.

I don'tthink I have the altest version. But if you put that script in menu_data.js file wouldn't it open every link in this new window?

If you don't add it to the links you want opening in anew window?
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

No, if you put it in the menu_data.js file the only links that would open in a new window are the ones that have the call for the function in the aI string

Code: Select all

aI("text=item;url=javascript:poptastic('http://whatever/');");
However, I don't think you need a function, the newest version of the menu has fixed the open new window problem as far as I know so you can just use the internal new window

Code: Select all

aI("text=item;url=whatever.htm;target=_new;targetfeatures=whatever features you want, or you can leave out target features;");
Ruth
jencam
Advanced
Advanced
Posts: 12
Joined: Fri Dec 16, 2005 1:07 pm
Location: Melbourne
Contact:

Post by jencam »

Sorry. I just checked which version I have and it is Version 5.735
So the _blank works
erik_c
Advanced
Advanced
Posts: 10
Joined: Thu Dec 08, 2005 11:06 pm

Post by erik_c »

Ruth wrote:

Code: Select all

var newwindow; 
function poptastic(url) 
{ 
   newwindow=window.open(url,'name','height=500,width=400,left=100, 
  top=100,resizable=yes,scrollbars=yes,toolbar=yes,status=yes'); 

} 

Code: Select all

aI("text=item;url=javascript:poptastic('http://whatever/');");
When opening new windows, it's extra helpful to give them focus, just in case the "newwindow" reference is minimized or in the background.

Code: Select all

var newwindow; 
function poptastic(url) 
{ 
   newwindow=window.open(url,'name','height=500,width=400,left=100, 
  top=100,resizable=yes,scrollbars=yes,toolbar=yes,status=yes'); 
  newwindow.focus();
} 
jencam
Advanced
Advanced
Posts: 12
Joined: Fri Dec 16, 2005 1:07 pm
Location: Melbourne
Contact:

Post by jencam »

Absolutely. It is good to have the new window at a smaller size than usual. Will take note.
burtg
Beginner
Beginner
Posts: 5
Joined: Wed Dec 21, 2005 5:35 pm

Target Windows - Now I get them where they weren't before!

Post by burtg »

On using Ver 5_734 and 5_738 I am geting a new browser window open up - when previously the pages just opened in the same window. Is this a bug?
Post Reply