473,804 Members | 3,113 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Accessing the global object

Bob
Is there anyway to access the global object from inside a function other
than doing a "var _global = this;" before declaring the function?

Thanks
Feb 22 '08
15 2058
On Feb 24, 2:04 pm, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
wrote:
Peter Michaux wrote:
[...] Thomas 'PointedEars' Lahn [...] wrote:
Peter Michaux wrote:
[...] Thomas 'PointedEars' Lahn [...] wrote:
Peter Michaux wrote:
[...] Thomas 'PointedEars' Lahn [...] wrote:
Peter Michaux wrote:
>On Feb 21, 5:10 pm, "Bob" <nob...@nowhere .comwrote:
>>Is there anyway to access the global object from inside a function
>>other than doing a "var _global = this;" before declaring the function?
>In a web browser the global object is usually available as a property
>"window" of the global object.
Nonsense. You are jumping to conclusions.
The word "usually" usually indicates one is not making a definitive
conclusion .
The word "usually" implies a perceived majority of cases where said
condition would apply.
Then I said what I meant. The overwhelming majority of JavaScript
hosts on earth are web browsers that have the global "window"
property.
Then I'm afraid your argument is a fallacious one indeed.
You've said things like this many times. As far as I know you have not
ever listed where these other billions of user agents are that are
not web browsers similar to IE4+/NN4+. Who/What/Where/Why/When/How are
they?

Your continuously missing the point,
If you clearly state your point then I will not miss it.

I stated that the overwhelming majority JavaScript hosts are web
browsers similar to NN4+ and IE4+. By this I also mean browsers like
IE7, FF2, etc. I am right. You seem to think I am wrong but you are
not able to identify these billions of JavaScript hosts that I should
consider. I would like to know to which billions of JavaScript hosts
you refer. They don't exist so you cannot do so. Instead you are
resorting to nitpicking about who has the burden of proof. Where are
your billions of hosts, Thomas? I'll even take hundreds of millions of
hosts if you can come up with those.

If you are trying to make some other point completely then I'm
interested what that is. There is no need to be so oblique about it.
Just say what you want to say in plain language. It cannot be so
difficult.

Peter
Feb 24 '08 #11
Thomas 'PointedEars' Lahn said the following on 2/24/2008 5:04 PM:
Peter Michaux wrote:
>[...] Thomas 'PointedEars' Lahn [...] wrote:
>>Peter Michaux wrote:
[...] Thomas 'PointedEars' Lahn [...] wrote:
Peter Michaux wrote:
>[...] Thomas 'PointedEars' Lahn [...] wrote:
>>Peter Michaux wrote:
>>>On Feb 21, 5:10 pm, "Bob" <nob...@nowhere .comwrote:
>>>>Is there anyway to access the global object from inside a function
>>>>other than doing a "var _global = this;" before declaring the function?
>>>In a web browser the global object is usually available as a property
>>>"windo w" of the global object.
>>Nonsens e. You are jumping to conclusions.
>The word "usually" usually indicates one is not making a definitive
>conclusion .
The word "usually" implies a perceived majority of cases where said
condition would apply.
Then I said what I meant. The overwhelming majority of JavaScript
hosts on earth are web browsers that have the global "window"
property.
Then I'm afraid your argument is a fallacious one indeed.
You've said things like this many times. As far as I know you have not
ever listed where these other billions of user agents are that are
not web browsers similar to IE4+/NN4+. Who/What/Where/Why/When/How are
they?

Your continuously missing the point, and making just more fallacious
arguments (here again: shifting the burden of proof), is becoming tiresome.

http://en.wikipedia.org/wiki/List_of_fallacies
You say they exist, someone else says they don't and asks you to prove
your argument. You don't and constantly whine about "shifting the burden
of proof". It is simple to prove what you say, just name a browser
without the window object being the global object. But no, you choose to
constantly whine about it and wonder why your credibility is at the
level it is.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 25 '08 #12
On Mar 2, 10:34 am, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
wrote:

[snip]
JFTR:http://wurfl.sourceforge.net/

So we have a maybe complete list of browsers used on mobile devices today.
However, that does not mean anything for tomorrow or user agents on other
devices.

So instead of having to check that list every day and update one's code
accordingly (which nobody could/would pay one for), one feature-tests for a
limited set of (in total) widely supported object models, including the
standardized one, and one will seldom have to change anything.
But how to choose that limited set? I have never read anyone's
concrete rules for making this choice but I have read criticism of the
mainstream library writers for their choices.
If it still happens that the code breaks in a user agent and that becomes
known to the developer, then one should maybe add a branch for that user
agent. That decision depends of course mostly on the bug in the user agent
that caused it, if it could be worked around at all. If not, the UA is
broken and should not be supported.
"maybe"? "mostly"?

I agree this is all grey area but people are frequently derided for
their choices in the grey areas. When pressed for justification I
haven't seen the critics present anything concrete.

Is it ok for a developer to say "I know this script destined for the
general web is broken in Internet Explorer 5.5 and Opera 9 but I don't
care?" It seems as though he would be ripped to shreds and accused an
idiot on c.l.js but he would simply respond "Those browsers are not
supported". That doesn't seem sufficient to the critics that don't
have objective support for their own similar decisions.

Peter
Mar 3 '08 #13
Thomas 'PointedEars' Lahn wrote:
Peter Michaux wrote:
>[...] Thomas 'PointedEars' Lahn [...] wrote:
>>So instead of having to check that list every day and update one's code
accordingly (which nobody could/would pay one for), one feature-tests for a
limited set of (in total) widely supported object models, including the
standardize d one, and one will seldom have to change anything.
But how to choose that limited set? I have never read anyone's
concrete rules for making this choice but I have read criticism of the
mainstream library writers for their choices.

I think that if you support the W3C DOM, the MSHTML DOM, the Opera DOM,
Apple WebCore, the KHTML DOM, and the NS4 DOM, you can be pretty sure that
your application does not break on the mobile device. [...]
^^^^^^^^^^^^^^
That should have been "that you application works". Graceful degradation
and feature tests should prevent the application from breaking even if
exposed to an unknown DOM.
PointedEars
Mar 3 '08 #14
VK
<snip>
All I want from you is the definition of the "feature detection". You
either can give it or you have no idea what are you talking about. I
am not answering your questions until I see that.
Mar 14 '08 #15
On Mar 14, 10:30 am, VK <schools_r...@y ahoo.comwrote:
<snip>
All I want from you is the definition of the "feature detection". You
either can give it or you have no idea what are you talking about. I
am not answering your questions until I see that.
Did Richard not write the following?

<URL: http://www.jibbering.c om/faq/faq_notes/not_browser_det ect.html>

That should pretty much explain it for you.

Peter
Mar 14 '08 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2109
by: Fernando Rodríguez | last post by:
Hi, I haven't used Python in quite some time, and I'm bit puzzled by this: counter = 0 class Blah(object): def run(self): counter += 1
2
2396
by: C Gillespie | last post by:
Dear All, I have 2 arrays var A1 = new Array(); A1 ="Y2"; var B1 = new Array(); B1 ="Y1"; B1 ="sink";
2
2627
by: Ekul | last post by:
I have an application that allows users to login and logout. I track how many users are logged in and when each individual is logged in. The application will not allow concurrent logins(let a user log in twice at the same time). My problem is I am having trouble telling when the user is logged off. If they click the logout button everything works fine. But if the close the browser by clicking the x or navigate to another url through the...
0
12090
by: sonu | last post by:
I have following client side code which i have used in my asp.net project SummaryFeatured Resources from the IBM Business Values Solution Center WHITEPAPER : CRM Done Right Improve the likelihood of CRM success from less than 20 percent to 60 percent. WHITEPAPER :
10
1640
by: Christian Christmann | last post by:
Hi, I'm wondering if my small example is not "dangerous": #define SIZE 10 char global; char* globalPtr = global; int main()
12
11725
by: Steve Blinkhorn | last post by:
Does anyone know of a way of accessing and modifying variables declared static within a function from outside that function? Please no homilies on why it's bad practice: the context is very particular and involves automatically generated code. I know several other ways of attacking my problem, but this would be the cleanest if it could be made to work. A little more context. I use C as the output of a code generating system which...
2
1900
by: rgparkins | last post by:
Hi Guys Maybe a simple and easy solution to this, but I keep getting exception object not set to instance etc etc. I have a Timer that is initiated in Application_Start in Global.asax. This timer I am using as a service every 10 minutes to send email to users. OK so all is fine until I need to load a file from the server (in fact an email template).
10
2368
by: Nemisis | last post by:
Hi everyone, I am trying to create a custom error page, that the user gets shown when a error has occurred within my website. The code works perfectly, apart from when an invalid URL is typed in, then i am unable to pass the exception from the global.asax file to the page via the sessionstate. Everytime i try to pass something into the sessionstate i get a error message of 'Object reference not set to an instance of an object.'
3
1785
by: anoop.kn | last post by:
Is there anyway to access Global Function Pointer from its name ? I want to call the function at runtime during a script execution. PS: eval() works, I looking for a more efficient way of doing the same ! Ex: function testfunction ( msg ) { alert( msg );
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9579
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10332
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10321
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9152
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6853
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2991
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.