Open a New Window from a Link

27 / 100

Hey there happy software developers/programmers. How many of you have problem looking to open a new window from your internet browser only to have something like below happen?

Javascript Logo

Here is a sample where most programmers would simply code their target to open in such a way.

<a href='' target='_blank'>Link</a>
<!-- The link should open another tab or a window? -->

It looks fool proof during the old times when tabs on the old browsers were not around, but if you were to do it now, it will usually just open a new tab.

Will you rather it open it in another new window, away from the tabs? Try the one below.

Would you like to know what are the 10 Interesting Things to do in Kuching, Sarawak, Malaysia?

Click the photo below to find out

10 Things to do in Kuching, Sarawak, Malaysia

Amazing isn’t it? All these can be done by just a simple touch of a script. Here is the solution

<a href='#'
onClick="'', '_blank', 'scrollbars=yes, resizable=yes, titlebar=yes');">
This calls back the homepage in a new window</a>

What are all these?
They are javascripts which will open in a new window. They can be broken into 3 parts.
1. The link (for this example I used
2. The target (you can choose the target of the link to be open)
3. Optional (there are many options, but I have used the following to enable scrollbars, resizable and also the title of the page)

Try the below link. You’ll be amazed.
This calls back the homepage in a new window

Now you know this simple tip.

To keep more tips and tricks, do help the webmaster to maintain this website with a simple donate. Thank you.

Leave a Reply