Can I control the position of new browser windows?

Can I control the position of new browser windows?

How can I control the position of new browser windows createdwith the window . open method?

Although JavaScript’s window . open method makes itpossible to automatically open new browser windows and control manyaspects of their appearance, the current version of JavaScript does not provide a way to control the browser windows’ positions on theuser’s screen. This has frustrated many JavaScript programmers.

The Microsoft Corporation, however, has addressed this problem in itsown, proprietary version of JavaScript, called “JScript.”(Implemented in the Internet Explorer browser, JScript is verysimilar to JavaScript, and sometimes even appears to be compatible.Unfortunately, there are many subtle differences in the features thatboth scripting languages support. What a wonderful way to keep thebrowser wars going! 🙂

In both scripting languages, the window . open method takesthe following form:

window . open (URL,window_name,window_features_list);

The first parameter is the URL of the document to be displayed in thenew window; the second parameter is the name of the new window (used forframe and window targets); and the third parameter is a quoted,comma-separated list of window features. (All three parameters arestrings.)

Although the window . open method works nearly the same inboth scripting languages, JScript supports two features in the windowfeatures list that JavaScript does not ? namely, the initial horizontaland vertical coordinates of the new window being opened. JScript callsthese features “left” and “top,” and they takethe form

left=hpixels, top=vpixels

where hpixels and vpixels are the horizontal andvertical pixel coordinates of the upper-left corner of the new window.

Thus, if you want your JScript program to open a 400×200-pixel windowin the upper-left corner of the user’s screen, you can do it inInternet Explorer with the following code:

window . open (location, name,"top=0,left=0,width=400,height=200");

Because Netscape Navigator simply ignores unrecognizedfeatures in the window features list, it is probably safe to useleft and top regardless of your “targetbrowser audience.” In fact, since there is a pretty good chance thatfuture versions of Netscape will support these features, itprobably won’t hurt to begin using them now. Remember, however, that atpresent they only work in Internet Explorer.

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes