I would like to have my page display the IP address of the user when the page loads. I have heard of the IP detection scripts when using the
"var ip = '<!--#echo var="REMOTE_ADDR"-->" attribute to make a window or alert popup and display the IP of the user, and I have also come some scripts that display the IP in the status bar. However, I want the current IP adress to be shown on the page itself, part of the <Body>.
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 have a page with a script that works only in IE and as I heard from feedbacks it doesn't run under IE on Mac.
I have browser type redirect script for that page that seems to be working fine except it doesn't detect the OS ( IE on Mac just gives blank page). Can someone add to the code that I would give me one page for IE on Windows and another one for all others? Code:
I'm using the code below for the "launch page" to open a JS window and know when it has been closed, and than execute some other code that should be run after the pop-up closes.
javascript Code:
This works, and does exactly what I want. Do any of you JS experts see any reason for concern? Anything that makes it suboptimal?
So I need script, which will detect users browser, and if browser will be IE, then show some link in content, if browser is FireFox or Opera, then hide that link. Link looks like:
I currently have a site which uses cookies, the problem is that I want it to detect if the browser being used has cookies enabled. I know you can accomplish this by setting a cookie in JavaScript and testing for it (i don't know how to do it, though), *BUT* I need the script to be compliant with all (or at least most) browsers. By this I mean, Mozilla, Firebird, Opera, IE, Netscape, and anything else you can think of.
I have some html code i would like to be printed to the page only if the browser has javascript enabled. I have tried to use document.writeln() but the string i want to print bot contains some ' and " in it. I don't know how to set the delimiters of the string that is passed as argument so that i don't get an error in the page.
I've have got this script, the only thing I want to be changed is the first part. It has to detect IE version 6 instead of just "Microsoft Internet Explorer". Can somebody help me out? I tried "Microsoft Internet Explorer 6" but that doesn't work.
We have a database application that runs in a popup Internet Explorer application window. The reason for this is to isolate the casual user from the address bar and the typical IE navigation buttons.
The application has a browser test page that displays an error message when a popup blocker is found and opens a popup page stating the test was successfull if there is no popup blocker.
Is there a reliable method (preferably javascript) for detecting the major popup blockers (SP2, AOL, Yahoo, Google, MSN, etc.)? We currently have a temporary solution in place which works OK but we would like to have a better solution.
We have already reasearched this on the net, as well as spent a few hours trying different options.
The application is designed to run on MSIE only so the solution can be Explorer specific.
I'd like to detect the shift key when a button is "clicked" in Firefox/Mozilla. If the button is clicked with the mouse, no problem. However, if the onclick event is keyboard originated, then my method is not working. Same thing for SELECT elements.
The simple web page below shows the issue. Click with the mouse while holding down the shift key, and the Shift key's status registers. However, use Shift+Alt+o, or either (while the button has focus) Shift+Space or Shift+Enter to kick off the onClick event and the shift key is not detected. Works fine with IE 6 on my Win XP Pro. Code:
I want to know the height of the viewable portion of a page (minus scrollbar) in Opera and Mozilla.
For Opera, I could use document.body.clientHeight. Unfortunately, this won't work in Mozilla because Mozilla also subtracts the sizes of the top and bottom margins.
For Mozilla, I could use document.documentElement.clientHeight. Unfortunately, this won't work in Opera because Opera returns the height of the entire page, not just the viewable portion.
So I have two options:
1) Use browser detection code to determine if the user is running Opera or Mozilla, and then use the appropriate clientHeight code.
2) Use window.innerHeight. This is supported by both Opera and Mozilla, however it returns the height of the viewable portion of the page *including* the scrollbar. Is there any way to determine the width of a scrollbar? If not, then I would have to make an assumption and subtract the hardcoded width of the scrollbar from window.innerHeight... but only if the scrollbar is present, is there a way to determine that?
Well after playing around a little I have created a solution that works although it appears a little chunky. The problem was finding the browser size to use the width as a variable for size conditional aspects to a site. Code:
I am looking for a detailed and correct browser detection script. Preferable a one that does not detect based on the UA string, but detects using DOM model or tests for functions, etc...
I'd like it to return OS, Browser and version as a separate variables.
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.
So I temporarily gave up on my breakout game (code) due to getting frustrated and a short trip, but it's time to finish it. After all, this is the only thing that's left to fix/do. The ball does not bounce correctly off the sides (the code in the checkBlocks function). It only/always seems that the first if statement evaluates to true, and when it gets to the second if statement, it doesn't evaluate to true because the other one already reversed the ball's direction. So how can I correctly determine where the ball came from?
Also, sometimes the ball gets stuck. For example, if you happen to hit the ball with the paddle in the bottom left corner, the ball will bounce back and forth along the left side of the board. I'm not sure how to fix this either.
I need a script that detects if the browser is viewing a certain page within a frameset, and if it is not, to open the page through frameset instead.
For example if the site has a mainframe and a navframe, if someone goes to the mainframe from a search engine, the script will open up the frameset html so the navframe shows up too.
I was wanting to use Javascript to detect the edit date on a series of .jpg files, and return that date in the corresponding HTML page, as in "Chart was last updated...". Does anyone know if this is possible, and if so how I would go about it?
A page I have shows a different background colour depending on the hash portion of the url as it is first loaded. For example a link to mysite/mypage#0000FF would result in a page with a blue background. But another link, this one to mysite/mypage#FF0000, would not give me a red background if directed to the window where mypage#0000FF was loaded just one moment ago. This is normally to be expected, because the browser thinks same page, no load event, basta.
If I use the search portion, for obvious reasons, that is treated a new page load, even when it is from the cache, but I need the hash here. So how do I detect in mypage the moment when the hash string is changed by a user click event on another page in another window, perhaps even from another domain?
We all know that feature detection technique works from very beggining of user-agents supporting JavaScript. We can alway check if eg. document has a write property or smth else:
if(document.write) { }
We could do that for all of objects, so i have been surprised when i found 'in' operator, which for above example would be used like this:
if("write" in document) { }
So i have questioned myself what for ? I can always do:
if(document["write"]) { }
or even var prop = [...]; if(document[prop]) { }
which is supported better then 'in' operator ('in' is supported since W. IE 5.5 and NN 6 - around 2000 year). I can only guess that 'in' was provided in W. IE 5.5 only for convenience... but that is my guess and someone more knowlegable could write here some more opinions on this operator...