I am developing a website in which I will support two screen resolutions ( 800X600 & 1024X768 ) by using two different stylesheets for better browsing experience. I need a code to detect resolution and then putting the desired stylesheet in page code at request time. If there is any server side language to be used with it then I can use PHP.
I'm going to make an attempt at coding a nice tree menu that is decent with browser support.
I want the tree to be displayed on all browsers (well, within a decent range). Of course, on older browsers, the menu won't be as functional.
Now, I'm going to be combining the javascript with a server-side language (asp.NET) and I'll be able to do some basic browser detection on the server.
But, I read about javascript object detection and am wondering how well that works exactly.
Like, what if a browser that doesn't support objects period tries to run some object detection code? Also, which browsers support user defined objects?
See, I'm thinking of breaking down the script in 3 categories. Browsers that won't get any javascript... these would be the browsers that don't support object detection, browsers with basic javascript... with these I would be able to code my own object and I would test for different features. And then there would be the browsers that can run it all.
So, basically, my question is what browsers support what features and how should I break down my code between them? A long time ago (back in the Netscape 4 / IE4 days) I did some javascripting, but since then I haven't really done any. I remember that NS4 didn't support div tags but supported layers... anyway, it got really messy.
I am working a project where I am using two monitors and using HTML/Javascript to display the information I want.
I have my main stuff on the main monitor, but when each page loads, I want an image to load fullscreen on the second monitor as well. I am using 800x600 resoution on both.
If I use:
function openWindow() { mainWindow = window.open("thispage.htm","pagename","fullscreen=yes"); }
that works fine for the main monitor.
I have then tried to use the second monitor to open an image by using the same type of thing:
function imageWindow() { openImage = window.open("image.jpg","imagepage","fullscreen=yes"); openImage.moveTo(801,0); parent.focus(); }
I am trying to use it with the onload command as well:
<body onLoad="imageWindow();">
I am passing arguments to these functions but simplified it here.
Anyhow it will only open it full screen on the first monitor. I can position it and move it to the second monitor if it is not full screen just fine.
I have a site up and running called www.kalahari.co.za which points to www.kalahari-adventures.co.za As the business depends on adventurous people seeing images of the place, the bigger the better. So I have designed the site to show one static background pic to each page. I sorted out a problem of different browsers by have a hidden index page that looks at the monitor a viewer has and decides that if you have a 1024 x 768 monitor it then opens a page index1024.htm that has the appropriately sized background pic.
Now I said to my client he would get better search engine ratings if we created 3 sites and the existing site is spread over those sites. Anyway I have done all that only to discover from High Rankings Advisor (highrankings.com that search engines have now cottoned onto this (competitors complaining I suppose). But I'm going ahead anyway.
My problem is that I have put all my keywords and descriptions on the 1024 pages. But if a person sees that page in a search engine clickt to view it and has a 800 x 600 monitor then my script is not going to work.
I have tried putting my index page script onto all the pages (see script below), but when I open a unique page it looks for the index page in the folder where that doc is situated. I suppose a quick and dirty would be to direct the viewer back to the index page which will then activates the scrpt (see below) that checks for the right monitor size.
I would prefer the viewer to stay on page. So If someone who knows Javascript can rewrite the script so that A) it looks at the name of the page. And B) once it sees that page's name it has to then look for that same page in the appropriate folder and open that page. (folders are docs800, docs1024 and docs1624)
The problem is that I can't have the same index page script because at the moment if the script is on the page I am trying to open, it loops forever.
How do I sort this out?
This is the present script on the index page.
<script language="JavaScript"> <!--// hide bad old browsers var s800x600page = "index800.htm"; var s1024x768page = "index1024.htm"; var s1152x864page = "index1264.htm"; var s1280x720page = "index1264.htm"; var s1280x960page = "index1264.htm"; var s1280x1024page = "index1264.htm"; var pagetype; if ((screen.height == 600) && (screen.width == 800)) { pagetype = 2; } else if ((screen.height == 768) && (screen.width == 1024)) { pagetype = 3; } else if ((screen.height == 864) && (screen.width == 1152)) { pagetype = 4; } else if ((screen.height == 720) && (screen.width == 1280)) { pagetype = 4; } else if ((screen.height == 960) && (screen.width == 1280)) { pagetype = 4; } else if ((screen.height == 1024) && (screen.width == 1280)) { pagetype = 4; } else { pagetype = 2; } if (pagetype == 2) { window.location.href = s800x600page } else if (pagetype == 3) { window.location.href = s1024x768page } else if (pagetype == 4) { window.location.href = s1152x864page } else if (pagetype == 4) { window.location.href = s1280x720page } else if (pagetype == 4) { window.location.href = s1280x960page } else if (pagetype == 4) { window.location.href = s1280x1024page } //--> </script>
I design but programming is still in my dreams ...
I am running client (browser) side Javascript, and would like to somehow be able to detect whether some Javascript code causes any changes to occur to the DOM model.
Is there any way to do this? For example, with some kind of try/catch block?
Is there a way to monitor a newly opepend child window with opener, even when the page keeps reloading ?
Say window A opens window B and gives it a name/handle "myWindow". At this point anywhere in window A, we could say myWindow.location.href to find out where the child is.
But what if someone was to take window A to another site, and than return using history button, OR reload it completely.
upon load the var myWindow would get executed again, and it seems like the handle would be lost. I tried to see if there was a window.children collection that might still hold window B in its subset, but was not able to find a way thus far.
I am interested in using RaphaelJS for creating VML/SVG rounded corners etc, but unless i physically put the <script> right after the element to which it needs to be applied, i have to rely on the single DOM load() event. which causes a delay before any script is executed,...thus a FOUC (flash of unstyled content).
i'm guessing there is no way to track when individual elements are loaded into the DOM via a CSS filter or similar, or another way around this other than having <script> in the body or just dealing the the load delay?
I want to make a custom visitor tracking tool and like Google Analytics it must be able to track how long time visitors spend on each page.How do you recommend doing this?I thought of using the Javascript onload event to start counting time serverside and then the onbeforeunload event to do tell the server to end the time count. I'm just skeptic of an infinite visit duration if the visitor's browser for some reason doesn't call the event (ie power outage).
.change() is only for form elements minus check boxes/radio buttons, etc.Are any of you aware of a script that does this already? Hopefully one that is easy to implement.I just want to monitor things like height, number of inner elements, or any change in the inner HTML.
I'm new to javascript and im trying to teach myself how to use it, however, ive come accross a problem. I'm using this code embeded in a HTML page for rollover images:
<script language="JavaScript" type="text/javascript"> <!-- if (document.images) {[code].....
This works completly fine in 1280 x 800 but goes mental when you hover over it in 1024 x 768 screen resolution.
I've been trying to get this script working to change a couple attributes in the CSS but it hasn't been working.
It's supposed to change the left and right margins of the #content tag if the resolution is greater that 1024x768. The text doesn't seem to want to stay in the center.
Heres the code: <!-- if (screen.width > 1024) { ChangeCSS('#content','marginLeft','28%');
[Code]....
The CSS code is all inline because this is a tumblr and I don't have a place to host style sheets.
I would like to set/create a single-use/temporary "cookie" for the duration of the user's session or possibly for up to 2 days and have a popup alert box, telling them that their screen resolution is too low to view. Here is my existing Javascript below.implement and/or rewrite it with the cookie?
Code: <script type="text/javascript"> <!--
if (screen.height<768 || screen.width<1024) alert ("Your screen's resolution is below 1024x768.This site works better at higher resolutions.");
The problem? On a computer with 1280x1024 resolution, IE detects it to be 1024 (thus sending the user to the wrong page). It works perfectly in all other browsers (that I have tried).
I was wondering if it is possible to remove content from a website based on the screen resolution, rather than have to redirect to a new URL.For example:
<if height greater than 800px> Lots of code <else> <br/> </if>
I am trying to create a page where it will look the same if the screen is resolution 1024 x 768 or if the screen is resolution 800 x 600.
The below finds the resolution but the page looks different depending on the resolution. how I can make a web page look the same no matter what the resolution?
I have a web application with an aspanel, users can add images, the program automatically make the thumbnail. when user click on thumbnail they can see a pop up modal page.
Images are in different sizes, so what I need to achieve is to get the screen resolution or browser visible area and re-size the image according to this resolution. (users could have different type of computer screen with different resolution), I need a Javascript or jquery code.
I was wondering if you had any idea how to show a ad based on screen resolution. Sort of like how espn.com has it...when your on 800 by 600 it doesn't show the ad and msn table on the right but when you are on 1024 or higher it does. Does anyone have any idea how to do this?