Feature Detection To Replace Use Of "navigator.userAgent" In Yahoo! UI Event.js?
Sep 1, 2006
I'm picking apart the Yahoo! UI event.js library and stripping it down
to just what I need. I'm also trying to make the parts I use better.
I'm stumped on how to fix the code for the getPageX() method. This
method is supposed to give the same value in IE as other browsers for
the event position relative to the left of the page. This value will be
greater than the position relative to the left of the browser if the
browser is scrolled to the right. What would be the appropriate feature
detection to use for the conditional in the following line?
if ( this.isIE ) {
Thank you,
Peter
isSafari: (/Safari|Konqueror|KHTML/gi).test(navigator.userAgent),
isIE: (!this.isSafari && !navigator.userAgent.match(/opera/gi) &&
navigator.userAgent.match(/msie/gi)),
getPageX: function(ev) {
var x = ev.pageX;
if (!x && 0 !== x) {
x = ev.clientX || 0;
if ( this.isIE ) {
x += this._getScroll()[1];
}
}
return x;
},
_getScroll: function() {
var dd = document.documentElement, db = document.body;
if (dd && dd.scrollTop) {
return [dd.scrollTop, dd.scrollLeft];
} else if (db) {
return [db.scrollTop, db.scrollLeft];
}
return [0, 0];
}
View 10 Replies
ADVERTISEMENT
Jul 23, 2005
navigator.userAgent returns information about the user operting system,
Browser etc.
Usually you get somthing like:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
or
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET
CLR 1.1.4322)
or
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624
Netscape/7.1 (ax)
imho there is too many information, most of it confusing for the user. What
I would like to do is, evaluate the information and
reduce it to the opereting system and browser version.
e.g.
MSIE 6.0, Windows XP
or
Netscape 7.1, Windows 98
obstacles:
- As far as I know, the structure of the data returned by
navigator.userAgent depends on the browser.
So a specification for each browser would be a good starting point, any
ideas where to find?
- Why do I get "Windows NT 5.1" instead of "Windows XP"? Any other
synonyms?
I neither tested it on macs nor linux systems...
View 12 Replies
View Related
Jan 5, 2003
Why is /MSIE (5.5)|[6789]/.test(navigator.userAgent) true
when navigator.userAgent == "Opera/7.0 (Windows 2000; U) [en]" ?
View 3 Replies
View Related
Feb 9, 2006
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...
View 22 Replies
View Related
May 5, 2003
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.
View 4 Replies
View Related
Sep 27, 2010
I need to know that navigator (IE or FF) was restarted or just know that cache was deleted.When I change sth in JS script, my old script is still in user navigator cache. I need user to use my new script, so he/she must clear cache or restart navigator (or maybe sth else). I show allert() that he/she mast do it, but how can I ckeck he/she did it?
View 1 Replies
View Related
Jul 23, 2005
I am trying to read all the navigator object elements
1. Using the navigator.length returns undefined, cant use for loop;
2.Using and array of known elements like
var a = Array("appCodeName","appName","appVersion");
I seem to miss something to get it combined like navigator.a[i]
View 13 Replies
View Related
Sep 1, 2005
Where can I find a list of valid names for Navigator.AppName?
View 13 Replies
View Related
Jun 16, 2009
I have this code and I don't understand why this isn't working.Head section:
<script>
function IEorMoz(){
// get browser resolution
[code]...
ps I know the 2 div's are the same, but this is only for testing.
View 40 Replies
View Related
Jul 23, 2005
I am trying to test changes to my site (made only on my local machine so
far) in IE v6, Mozilla 1.6, and Opera 7.5.
When I test "navigator.javaEnabled in IE it corretly reports true/false
depending on whether javascript is enabled.
However, both Mozilla and Opera *always* return false. How can I properly
test to see if javascript is enabled/disabled in these two browsers? (If you
have a reference on the web, please point me to it as I've spent several
hours trying to find what I need.) Code:
View 1 Replies
View Related
Aug 15, 2011
I dedicated some time creating my own carousel with images, and got a little problem:
It works perfectly when I´m on the website, but when I change between the tabs on firefox/chrome, it seems that the function make some kind of queue, and when I come back to the website, it execute the function a lot of times at the same times, passing between the images in less than half second (I configured to change every 5 seconds).
function circCar (car) {
Here is the code, and if anybody wants to see the problem, open this url, open another tab (blank or another website) and stay on it about 15 seconds, when you come back to my site, you will see the queued function. [url]
View 2 Replies
View Related
Jul 23, 2005
In Yahoo mail, I click the Inbox link and see my messages. If I view
source, I don't have HTML which contains the URL of each message. The
source HTML contains javascripting and framesets. This is different from
what I am seeing.
If I right click on a message link and select "copy shortcut", I can paste
this link into my browser. This brings me to my message. If I view source,
once again, it is javascript and framesets. How do I get at the HTML that
is making all the tables and contains the images I'm seeing?
Accessing IE DOM is a possibility but won't that just give me access to the
javascripting and framsets since that is all the client has (remember what
is seen in view souce)? I know the HTML has to be accessible somehow.
Otherise, you wouldn't see it...right?
View 11 Replies
View Related
Jul 23, 2005
Does anyone have or know of script that will stop yahoo adding their adverts to end of post to groups?
View 3 Replies
View Related
Mar 14, 2006
Not sure whether this is possible but what i want is to add an "Send To
A Friend" button, but i want the button to send an email to an address
(Specified by user) from my personal Hotmail or Yahoo account instead
of starting the users default email client.
View 3 Replies
View Related
Sep 27, 2002
This is a more compact view of the "open ad" code on yahoo.
<pre>
<script language=javascript>
// these are the two links for opening and closing the ad
var lnk1='<a href="#" onclick="moveIt(Ƈ');return false">Open Ad</a>'
var lnk2='<a href="#" onclick="moveIt(Ɔ');return false">Close Ad</a>'
// these are the contents of the table, you can put anything in here
var ad1='CLOSED STATE'
var ad2='OPEN STATE'
// this function actually moves the DIV size
function moveIt(status)
{
var tout=0;
if(status == Ƈ')
{
lnkdiv.innerHTML=lnk2;
adstate.innerHTML=ad2;
if (document.all.addiv.style.pixelHeight<250)
{
document.all.addiv.style.pixelHeight=document.all.addiv.style.pixelHeight+5;
tout=setTimeout('moveIt('+status+')',1);
}
}
else
{
lnkdiv.innerHTML=lnk1;
adstate.innerHTML=ad1;
if (document.all.addiv.style.pixelHeight>=105)
{
document.all.addiv.style.pixelHeight=document.all.addiv.style.pixelHeight-5;
tout=setTimeout('moveIt('+status+')',1);
}
}
}
</script>
<table border="1"><tr><td><div id=addiv
style="position:relative;height:100;width:300;z-index:3"><div id=adstate>CLOSED
STATE</div></div></td></tr></table>
<div id=lnkdiv><a href="#" onclick="moveIt(Ƈ');return false">Open Ad</a></div>
</pre>
View 2 Replies
View Related
Sep 20, 2011
I'm building a web site ala autos.yahoo.com on servicos.mpl.pt/comparador/css1.php I have a sidebar with filtering options grouped in an accordion. The accordion panels get populated via jquery like:
Code:
//getMarcas
$(function() {
//get tag feed
[Code]...
View 3 Replies
View Related
Oct 30, 2006
I would like to build some tabs like Yahoo uses on their hompeage. Are they built in ajax? If so anyone know how to acheive this function?
View 2 Replies
View Related
Sep 19, 2005
Yahoo mail uses a button that has two functions. If you click on the
major portion it will launch your search. If you click on the image
that is on the right of the button ( a triangle pointing downward) it
will popup a little div menu.
View 2 Replies
View Related
Jan 12, 2007
If you've played around with Yahoo's new Beat email interface you'll notice that they now have adjustable columns to reveal the from, subject, date, size information. This is also found in Outlook and all windows OS. Placing your cursor between two columns allows you to move a column left or right to reveal content of each row.
Does anyone know how this is done? I have not seen it anywhere else on the internet, but in Yahoo's beta email.
View 1 Replies
View Related
Sep 29, 2007
There are tons of lightbox apps out there, but none that I could find that use YUI. I'm sure there are lots of developers out there already using YUI and don't want to have to use another library such as jQuery to get lightbox functionality. I have two demos available from the link below and you can download a zip file of the complete application including the YUI files needed.
Supports 3 modes (LightBox, Overlay and Remote), but many many more configurations...
View 2 Replies
View Related
Oct 8, 2010
how the yahoo ad serving script can be used to serve up ads up using JavaScript that isn't inline? I've attempted several things but it just seems like its impossible to do. Essentially, I would like to swap out a new round of ads per AJAX request. Any ideas? I've created a more friendly user interface for a site I'm working on but the thing is that the ads need to change every request since page refreshes are being eliminated. Otherwise, only a single impression may be tracked even though someone has visited essentially 100 pages, which is no good for the ad business.
Also, has anyone had success finding a way to delay the yield manager until the page has fully loaded? Sometimes the yahoo yield manager can take 10+ seconds resulting in a poor user experience and slow load time. Any ideas for that? Essentially, it would be nice to fully load the page than request the ads without using obtrusive JavaScript which seems to be the only way yahoo knows to do things.
View 2 Replies
View Related
Jan 11, 2011
Is it possible to submit multiple links all at the same time using Javascript? I check all over the web and can't find any examples anywhere.
I would like to click on a button and submit to google, yahoo, msn, etc all at the same time. Like someone physically click on [url], [url], [url], so on.
View 3 Replies
View Related
Aug 11, 2006
how to hide all toolbars like yahoo,google etc onLoad.
Actually window.open function cannot be taken into.I need the toolbars to be hidden in the beginning.
View 2 Replies
View Related
Jan 11, 2011
Is it possible to submit multiple links all at the same time using Javascript? I check all over the web and can't find any examples anywhere.
I would like to click on a button and submit to google, yahoo, msn, etc all at the same time. Like someone physically click on [url], [url], [url], so on.
View 3 Replies
View Related
Jul 23, 2005
I'd like to write a HTML page which can help me directly log in my
Yahoo!mail or Gmail account without typing user name and password.
Basically, I want to set up a link, click it and pop up the Yahoo/Gmail
page.
What technology is most appropriate for this kind of work?
My current solution is not so satisfying: I download Yahoo!Mail page
and save it to local file; then using Javascript to load that file and
set up user name, password, submit it to Yahoo.
This works with Yahoo, but not Gmail. I haven't got time to investigate
why.
The thing I hate about this solution is: for every email provider, I
need to download their page and write corresponding page to
access/modify it.
View 12 Replies
View Related
Apr 27, 2009
I need to build a Tabbed panel similar to yahoo mail (latest version). Means whenever I click on the link the page should be open in new tab, with closing button. Is there any jQuery plugin which provides same functionality.
View 1 Replies
View Related