Rajasekar
Rajasekar

Reputation: 18978

How can I open a popup window with a fixed size using the HREF tag?

I have a link like this:

$contact_url = "<a href=rentals_popup.php?id=$row->rentals_id >" . "Contact" . "</a>";

How can I open that page in a different window with?

Smaller width and height

Disabled maximize button

Upvotes: 12

Views: 108664

Answers (5)

stanidani
stanidani

Reputation: 11

I can't comment on Esben Skov Pedersen's answer directly, but using the following notation for links:

<a href="javascript:window.open('http://www.websiteofyourchoice.com');">Click here</a>

In Internet Explorer, the new browser window appears, but the current window navigates to a page which says "[Object]". To avoid this, simple put a "void(0)" behind the JavaScript function.

Source: https://support.microsoft.com/en-us/kb/257321

Upvotes: 1

Anas Toumeh
Anas Toumeh

Reputation: 201

Since many browsers block popups by default and popups are really ugly, I recommend using lightbox or thickbox.

They are prettier and are not popups. They are extra HTML markups that are appended to your document's body with the appropriate CSS content.

http://jquery.com/demo/thickbox/

Upvotes: 4

AverageAdam
AverageAdam

Reputation: 337

You might want to consider using a div element pop-up window that contains an iframe.

jQuery Dialog is a simple way to get started. Just add an iframe as the content.

Upvotes: 0

Thomas
Thomas

Reputation: 182018

Plain HTML does not support this. You'll need to use some JavaScript code.

Also, note that large parts of the world are using a popup blocker nowadays. You may want to reconsider your design!

Upvotes: 7

Esben Skov Pedersen
Esben Skov Pedersen

Reputation: 4517

This should work

<a href="javascript:window.open('document.aspx','mywindowtitle','width=500,height=150')">open window</a>

Upvotes: 28

Related Questions