Tech Today

Archive for the ‘javascript’ Category

One of my clients today asked me if I could send him some code that would effectively open a new browser window to a fixed height and width, with no menu bar.

This is a basic problem that might be worth knowing in the future. So here is the solution:

First you need to add this code between the <head></head> tags of your HTML document:

<script type="text/javascript">
function openpopup(address){
window.open(address,"","fullscreen=no,toolbar=no,status=no,
menubar=no,scrollbars=no,resizable=no,width=500,height=500");
}
</script>

Then you will need to create a link somewhere in your document. Like so:

<a href="javascript: openpopup('http://www.google.com')"> Click here to open the page in a new window. </a>

And vola! You are now able to open links in a new browser window! Now, this solution will also work for local html documents, but I believe it is always better practice to put the full URLs in anyways. Hope this solution works for you and enjoy!