user3435760
user3435760

Reputation: 1

Open new page at specific size

I have rollover that when clicked opens a link (video) in a new page or tab depending on if I specify target="_blank". Question? Can I control the width of this new (parent) page. I would like it to be ~80% smaller than the parent just to show the user that it is a separate page. Or.. How can I have this code open in a window of the existing page? Thank you for your time

    <div id="apDiv3"><a href="Fork at 57km.mp4" target="_blank" onmouseover="MM_swapImage('fork 57','','fork 57.jpg',1)" onmouseout="MM_swapImgRestore()"><img src="Rollover blankBL.png" alt="Fork at 5.7 Km stay right" width="400" height="225" id="fork 57" /></a></div>

Upvotes: 0

Views: 4306

Answers (1)

Lenny
Lenny

Reputation: 5937

As you mentioned in your own post you can use window.open read the window.open documentation for more info. You can specify many parameters about the popup. A simple popup with explicit width / height would look like this:

  window.open('http://www.google.com',"My Window Name", "width=400,height=400")

I also created a plunker so you can see it in action

HOWEVER, I really advise against using this. This is the OLD way of doing things. This type of popup hasn't been popular for well over 10 years now. Outside of being annoying and unpopular it is also not dependable. Some browsers / popup blockers will totally block this window from opening.

A better alternative is to use some sort of JS modal library to load the content within the actual page (not in a new window).

One I really like is Magnific Popup they have a bunch of examples on their page.

Upvotes: 1

Related Questions