Find Users screen resolution without using javascript

Is it possible to find a users screen res (and output it to the user) without using javascript.

What I would really like to do is act upon the screen res that is found. I am using a application where i can program some html that will run a script inside the app, what i would like to do is, if
screen res 800x600 run script 1 and so on.
nathan1038Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
abelConnect With a Mentor Commented:
> I just want to be sure that the user has javascript or else they will not be able to see the html page

you use a WebBrowser control (or something similar) in your application. On any windows machine, the web browser control uses the functionality of the browser installed on that machine. If the web browser has javascript enabled, so will the browser.

> When might this be the case (that they need to install javascript) would it be only if they had IE 4 or 5,

I'm not sure if you read my other comment where I answered this alreayd, but JavaScript is there, ALWAYS, and cannot be installed, ever, for a browser. The time without JavaScript goes back to about 1994 (iirc), the times of Netscape 2 and Netscape 1 and the Mosaic browser (who were the dominant players at the time). From 1995, with Netscape 3 and Internet Explorer 3 Javascript entered the world.

Unless you plan to deploy on computers with Windows 3.1 or earlier, MS-DOS or the Commodore computer, you shouldn't worry about the presence of JavaScript: it is there.

Even though JavaScript cannot be installed or uninstalled, it can be disabled. You can check that with the <noscript> tag. But considering your scenario, it sounds to me that this will never be the case.
> To summarize, at my app stands it is vital that javascript be present and non disabled so this is really important to me to get right

Since you are using (likely, you didn't say) a WebBrowser control, you can control this yourself for that control, but it is not easy. There are two techniques: first, load a page with some script that uses window.external and an object the exposes some COM objects, which you can set to the ObjectForScripting object. If it is called, scripting is on. Second, read the registry.

The problem with the first approach is: it is dificult to get right unless you know enough about COM, JavaScript and the WebBrowser control (and how callbacks / delegates work).

the problem with the second approach is: you need registry read permissions, which you often won't have...

Either way, you can always just simply use the <noscript>please enable scripting</noscript> tag to warn the users that they should enable scripts.

-- Abel --
0
 
erikTsomikSystem Architect, CF programmer Commented:
i do not think that you can do this without using javascript
0
 
abelCommented:
Unfortunately, that is not possible. The only things you can do without javascript if finding out the data that is send as part of the HTTP request (this include the browser identification string) and the screen resolution is not part of this.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
abelCommented:
What I don't understand from your question is that you are saying something like "if the screen resolution is this and that, then I want to run a script" but at the same time you are saying that you do not want to use javascript. What is it: you want to run a script based on a condition without using scripting?
0
 
samrellisCommented:
If you do use a script, best to use from a library like jQuery as that will handle all the differences between the browser ... removing a lot of headaches.

good luck
0
 
nathan1038Author Commented:
Im still trying to find a way of installing javascript onto the users computer. Like firefox, if you dont have it installed, it tells you right, then gives you a button to install it, can I do this
0
 
abelCommented:
????

sorry, but that is totally off. JavaScript is available on ALL browsers currently on the market. Firefox, Internet explorer, Opera, Safari: all of them support JavaScript. It can be disabled, yes, but it cannot be installed (or uninstalled).

Maybe this is a good moment to show us some code of what you are trying to do? Maybe this is not about JavaScript after all?
0
 
samrellisCommented:
Nathan,

1) what are you building you application with?

2) are you confusing javascript with flash maybe.


0
 
nathan1038Author Commented:
I am using a application that can have browser objects inside it. By a browser object what i mean is, I draw a window, 300x400 and it is definitly sized browser window.

Therefore if i loaded yahoo.com through it, it would see only the top left of the main page and you
would have to scroll down and across to see the entire page. (like shrinking down a browser window to that size)

The aplication uses Internet explorer only, therefore is for PC's only. Through this window I am building web pages, some of which have javascript inside them.

I just want to be sure that the user has javascript or else they will not be able to see the html page.

When might this be the case (that they need to install javascript) would it be only if they had IE 4 or 5,
I am not that knowledhgable about javascript (obviously) so can you tell me your thoughts on this.

To summarize, at my app stands it is vital that javascript be present and non disabled so this is really important to me to get right
0
 
samrellisCommented:
If you are developing an application, that should have hooks that let you discover the size of the user's screen - do it inside the app, not within the embedded web pages.

Good luck
0
All Courses

From novice to tech pro — start learning today.