Skip to content Skip to sidebar Skip to footer

How Can I Open A Popup Window With A Fixed Size Using The Href Tag?

I have a link like this: $contact_url = 'rentals_id >' . 'Contact' . ''; How can I open that page in a different window with?

Solution 1:

This should work

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

Solution 2:

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!

Solution 3:

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/

Solution 4:

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

<ahref="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

Solution 5:

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.

Post a Comment for "How Can I Open A Popup Window With A Fixed Size Using The Href Tag?"