Open link in new window/tab with specific width

Hi all, @J805,

I am using the Toolbox plugin to access a link in a new tab like this but the width component is not working:

image

Any ideas what is the correct syntax for this?
Thanks,
David

1 Like

Hmmm :thinking: Good question.

I’ve never tried it like this. What is the width you are you trying to send? The page width or something?

Maybe something like this? javascript - onclick open window and specific size - Stack Overflow

1 Like

Hi Jason,

Yes it was the page width. That link you sent was the one I was trying to copy the syntax from.

David

2 Likes

Ahh ok, so like this:

<a href="/index2.php?option=com_jumi&amp;fileid=3&amp;Itemid=11" onclick="window.open(this.href,'targetWindow','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=SomeSize,height=SomeSize'); return false;">Popup link</a> 

Hmmm, I would try to copy it exactly how it is first. See if it works. Then change things one at a time and checking that it still works each time. That would be the best way to troubleshoot. Does that makes sense?

It doesn’t seem to work for me no matter what I put in there. Hmmm. :thinking:

1 Like

Ok, so I found that this:

 window.open ("http://www.javascript-coder.com",
"mywindow","menubar=1,resizable=1,width=350,height=250"); 

works when using the Run Javascript, as long as you aren’t in full screen mode.

I just do everything in full screen mode so it would never work for me. :blush:

This is what it looks like:


Hope that helps! :blush:

@j805 www.NoCodeMinute.com

For All Your No-Code Education Needs:

2 Likes

Thanks for sharing, that’s what i was looking for!

Thanks @J805 ,

I have it working (even in full screen mode) with this:
image

I also had the “menubar=1,resizable=1,” part in there to begin so having this in there didn’t prevent this.

However the window opens with the top of the window out of view (too high):

I wonder is there a setting of where to start the window (like an x, y coordinate) type thing if that makes any sense?

Any thoughts? Did you get it working @CoraTorres ?

It does look like you can do the position from the left and from the top. Check it out: Window open() Method

Hope that helps. :blush: