473,406 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

partitioning the program depending upon browser

Hallo,

I am developing a site, and here whats the problem is: how to
partition the code, i.e. if I developed 1000 lines of code, in that I
want to show first 200 lines only if the user opens my website using
IE, and next 200 lines in Firefox, and remaining lines in another
browsers.

Here am asking that how to compatible the total code depending upon
the browsers used by users.

if you know any thing please mail me to rajaja...@gmail.com

thanking you,

Best Regards,
Rajasekhar.

Apr 19 '07 #1
9 1544
On Apr 19, 2:45 pm, rajasekhar <rajaja...@gmail.comwrote:
Hallo,

I am developing a site, and here whats the problem is: how to
partition the code, i.e. if I developed 1000 lines of code, in that I
want to show first 200 lines only if the user opens my website using
IE, and next 200 lines in Firefox, and remaining lines in another
browsers.

Here am asking that how to compatible the total code depending upon
the browsers used by users.

if you know any thing please mail me to rajaja...@gmail.com

thanking you,

Best Regards,
Rajasekhar.
If you are using PHP, you can investigate the _SERVER superglobal
variable, specifically its "HTTP_USER_AGENT" element, which for
example could be something like:
$_SERVER["[HTTP_USER_AGENT"] = "Mozilla/5.0 (X11; U; Linux i686
(x86_64); en-US; rv:1.8.1.1) Gecko/20061208 Firefox/2.0.0.1"

ASP.NET probably has its own ways of doing this. The point is, you
have to generate your code, cause from JS itself, I'm not sure you can
easily load js files and contents of your choice. From PHP, however,
you could, based on the value of $_SERVER["HTTP_USER_AGENT"], do
something like:
if ( strstr( $_SERVER["HTTP_USER_AGENT"], "Firefox" ) !== false )
echo "<script type='text/javascript' src='first.js'></
script>";
else if ( ... )
echo "<script type='text/javascript' src='second.js'></
script>";
etc.

Cheers

Apr 19 '07 #2
On Apr 19, 4:21 pm, Darko <darko.maksimo...@gmail.comwrote:
On Apr 19, 2:45 pm, rajasekhar <rajaja...@gmail.comwrote:
Hallo,
I am developing a site, and here whats the problem is: how to
partition the code, i.e. if I developed 1000 lines of code, in that I
want to show first 200 lines only if the user opens my website using
IE, and next 200 lines in Firefox, and remaining lines in another
browsers.
Here am asking that how to compatible the total code depending upon
the browsers used by users.
if you know any thing please mail me to rajaja...@gmail.com
thanking you,
Best Regards,
Rajasekhar.

If you are using PHP, you can investigate the _SERVER superglobal
variable, specifically its "HTTP_USER_AGENT" element, which for
example could be something like:
$_SERVER["[HTTP_USER_AGENT"] = "Mozilla/5.0 (X11; U; Linux i686
(x86_64); en-US; rv:1.8.1.1) Gecko/20061208 Firefox/2.0.0.1"

ASP.NET probably has its own ways of doing this. The point is, you
have to generate your code, cause from JS itself, I'm not sure you can
easily load js files and contents of your choice. From PHP, however,
you could, based on the value of $_SERVER["HTTP_USER_AGENT"], do
something like:
if ( strstr( $_SERVER["HTTP_USER_AGENT"], "Firefox" ) !== false )
echo "<script type='text/javascript' src='first.js'></
script>";
else if ( ... )
echo "<script type='text/javascript' src='second.js'></
script>";
etc.

Cheers
thank you, and its working.
urs,
rajasekhar

Apr 19 '07 #3
Darko said the following on 4/19/2007 10:21 AM:
On Apr 19, 2:45 pm, rajasekhar <rajaja...@gmail.comwrote:
>Hallo,

I am developing a site, and here whats the problem is: how to
partition the code, i.e. if I developed 1000 lines of code, in that I
want to show first 200 lines only if the user opens my website using
IE, and next 200 lines in Firefox, and remaining lines in another
browsers.

Here am asking that how to compatible the total code depending upon
the browsers used by users.

if you know any thing please mail me to rajaja...@gmail.com

thanking you,

Best Regards,
Rajasekhar.

If you are using PHP, you can investigate the _SERVER superglobal
variable, specifically its "HTTP_USER_AGENT" element, which for
example could be something like:
$_SERVER["[HTTP_USER_AGENT"] = "Mozilla/5.0 (X11; U; Linux i686
(x86_64); en-US; rv:1.8.1.1) Gecko/20061208 Firefox/2.0.0.1"
And then discover why the User Agent string is 100% unreliable?
ASP.NET probably has its own ways of doing this. The point is, you
have to generate your code, cause from JS itself, I'm not sure you can
easily load js files and contents of your choice.
It is quite trivial actually. Search the archives for loadJSFile along
with my name. Might be some interesting reading in there somewhere.
There is also a long thread entitled "createTextNode and IE" that is
interesting reading.

To date, the only browser that I know of that I can not dynamically load
a .js file is iCab, and NS6. Since you appear to be using Linux based
software, perhaps you could check the buttons on this page for me:

<URL: http://members.aol.com/_ht_a/hikksnotathome/loadJSFile/>

You should get an initial alert and then clicking on a button at the top
should give you a new alert if the browser supports that method.

From PHP, however, you could, based on the value of
$_SERVER["HTTP_USER_AGENT"], do something like:
if ( strstr( $_SERVER["HTTP_USER_AGENT"], "Firefox" ) !== false )
echo "<script type='text/javascript' src='first.js'></
script>";
else if ( ... )
echo "<script type='text/javascript' src='second.js'></
script>";
I think if I were going to use that scenario, my first string to test
for would be the word "Opera" instead of any other browser.

But, just to satisfy my curiosity, what code would you give to a UA
where the UserAgent string contains this, and only this, string:

"My F**king Browser"

The asterisks are there because this is a family oriented group but I
think you can guess what they should be. Would you tell me that your
page wouldn't work in the browser simply because you can't determine,
based on a bogus string, what code to give me?

<URL: http://jibbering.com/faq/index.html#FAQ4_26>

More interesting reading.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 19 '07 #4
"Randy Webb" <Hi************@aol.comwrote in message
news:46********************@giganews.com...
To date, the only browser that I know of that I can not dynamically load a .js file is
iCab, and NS6. Since you appear to be using Linux based software, perhaps you could
check the buttons on this page for me:

<URL: http://members.aol.com/_ht_a/hikksnotathome/loadJSFile/>

You should get an initial alert and then clicking on a button at the top should give you
a new alert if the browser supports that method.
I was unsure of something, does your Mozilla test include all related products? As in,
since it did not support "Change Source" or "Change InnerHTML", then Firefox probably
won't either?

(I did test with Firefox 1.5.0.11. I thought at least the innerHTML example would work.)

Also, "Change Source" in Internet Explorer 6.0.2900.2180.spsp_sp2_gdr.050301-1519 (XP SP2)
appears to load the file (I can see it downloading) but I never get an alert.

-Lost
Apr 21 '07 #5
Hi Randy,
It is quite trivial actually. Search the archives for loadJSFile along
with my name. Might be some interesting reading in there somewhere.
There is also a long thread entitled "createTextNode and IE" that is
interesting reading.

To date, the only browser that I know of that I can not dynamically load
a .js file is iCab, and NS6. Since you appear to be using Linux based
software, perhaps you could check the buttons on this page for me:

<URL:http://members.aol.com/_ht_a/hikksnotathome/loadJSFile/>
Have you done any more investigation in this about sequential file
loading or the other smaller details we talked about?

Thanks,
Peter

Apr 21 '07 #6
-Lost said the following on 4/20/2007 8:05 PM:
"Randy Webb" <Hi************@aol.comwrote in message
news:46********************@giganews.com...
>To date, the only browser that I know of that I can not dynamically load a .js file is
iCab, and NS6. Since you appear to be using Linux based software, perhaps you could
check the buttons on this page for me:

<URL: http://members.aol.com/_ht_a/hikksnotathome/loadJSFile/>

You should get an initial alert and then clicking on a button at the top should give you
a new alert if the browser supports that method.

I was unsure of something, does your Mozilla test include all related products?
No. That is why it also contains an entry for Firefox2.0 on WinXP. The
Linux and MAC testing were done by others so I assume it was Mozilla
proper and not a derivative as there are some derivatives listed seperately.
As in, since it did not support "Change Source" or "Change InnerHTML", then Firefox
probably won't either?
I doubt it as Changing Source is an IE proprietary thing by accessing it
via an ID attribute of the Script element. The innerHTML test won't work
in Firefox either.
(I did test with Firefox 1.5.0.11. I thought at least the innerHTML example would work.)
On what OS? I have it on XP and some results for Mac OSX.
Also, "Change Source" in Internet Explorer 6.0.2900.2180.spsp_sp2_gdr.050301-1519 (XP SP2)
appears to load the file (I can see it downloading) but I never get an alert.
I am going to have to check into that one. IE7 doesn't work from the
on-line version so I will have to figure out why as when I tested it (I
did the IE7 testing) it worked at the time for me to have put it on
there as working. And just now re-testing it works offline so it is
either something to do with the offline/on-line or the AOL server
screwing it up.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 21 '07 #7
Peter Michaux said the following on 4/20/2007 8:10 PM:
Hi Randy,
>It is quite trivial actually. Search the archives for loadJSFile along
with my name. Might be some interesting reading in there somewhere.
There is also a long thread entitled "createTextNode and IE" that is
interesting reading.

To date, the only browser that I know of that I can not dynamically load
a .js file is iCab, and NS6. Since you appear to be using Linux based
software, perhaps you could check the buttons on this page for me:

<URL:http://members.aol.com/_ht_a/hikksnotathome/loadJSFile/>

Have you done any more investigation in this about sequential file
loading or the other smaller details we talked about?
They are still on my to-do list that seems to be never ending. The issue
with it now of not loading from the AOL server on a change source click
has moved it up in the stack though.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 21 '07 #8
"Randy Webb" <Hi************@aol.comwrote in message
news:D8********************@giganews.com...
-Lost said the following on 4/20/2007 8:05 PM:
>"Randy Webb" <Hi************@aol.comwrote in message
news:46********************@giganews.com...
>>To date, the only browser that I know of that I can not dynamically load a .js file is
iCab, and NS6. Since you appear to be using Linux based software, perhaps you could
check the buttons on this page for me:

<URL: http://members.aol.com/_ht_a/hikksnotathome/loadJSFile/>

You should get an initial alert and then clicking on a button at the top should give
you a new alert if the browser supports that method.

I was unsure of something, does your Mozilla test include all related products?

No. That is why it also contains an entry for Firefox2.0 on WinXP. The Linux and MAC
testing were done by others so I assume it was Mozilla proper and not a derivative as
there are some derivatives listed seperately.
There is an entry for Firefox? I do not see it... oh wait...

You made it an overflow! I just now realized there is something beyond Mozilla 1.5 on Win
ME. Hehe...
>As in, since it did not support "Change Source" or "Change InnerHTML", then Firefox
probably won't either?

I doubt it as Changing Source is an IE proprietary thing by accessing it via an ID
attribute of the Script element. The innerHTML test won't work in Firefox either.
>(I did test with Firefox 1.5.0.11. I thought at least the innerHTML example would
work.)

On what OS? I have it on XP and some results for Mac OSX.
XP SP2. I must be missing something. For example:

document.getElementsByTagName('p')[0].innerHTML = 'Woof!';

....works just fine in Firefox 1.5.0.11. I guess more specifically though:

first_p = document.getElementsByTagName('p')[0];
first_p.innerHTML = '<script src="innerHTML.js" type="text\/javascript"><\/script>';

Whilst the first P does have the updated innerHTML, it does not allow access to that
script's contents. Bummer.

OK, maybe I am not missing anything. Heh.
>Also, "Change Source" in Internet Explorer 6.0.2900.2180.spsp_sp2_gdr.050301-1519 (XP
SP2) appears to load the file (I can see it downloading) but I never get an alert.

I am going to have to check into that one. IE7 doesn't work from the on-line version so
I will have to figure out why as when I tested it (I did the IE7 testing) it worked at
the time for me to have put it on there as working. And just now re-testing it works
offline so it is either something to do with the offline/on-line or the AOL server
screwing it up.
-Lost
Apr 21 '07 #9
-Lost said the following on 4/21/2007 1:47 AM:
"Randy Webb" <Hi************@aol.comwrote in message
news:D8********************@giganews.com...
>-Lost said the following on 4/20/2007 8:05 PM:
>>"Randy Webb" <Hi************@aol.comwrote in message
news:46********************@giganews.com...

To date, the only browser that I know of that I can not dynamically load a .js file is
iCab, and NS6. Since you appear to be using Linux based software, perhaps you could
check the buttons on this page for me:

<URL: http://members.aol.com/_ht_a/hikksnotathome/loadJSFile/>

You should get an initial alert and then clicking on a button at the top should give
you a new alert if the browser supports that method.
I was unsure of something, does your Mozilla test include all related products?
No. That is why it also contains an entry for Firefox2.0 on WinXP. The Linux and MAC
testing were done by others so I assume it was Mozilla proper and not a derivative as
there are some derivatives listed seperately.

There is an entry for Firefox? I do not see it... oh wait...

You made it an overflow! I just now realized there is something beyond Mozilla 1.5 on Win
ME. Hehe...
I did that originally to allow the Notes to be visible and the page was
getting sufficiently long enough that I didn't like the way it looked.
Maybe I need to go back to the non-overflow version.
>>As in, since it did not support "Change Source" or "Change InnerHTML", then Firefox
probably won't either?
I doubt it as Changing Source is an IE proprietary thing by accessing it via an ID
attribute of the Script element. The innerHTML test won't work in Firefox either.
>>(I did test with Firefox 1.5.0.11. I thought at least the innerHTML example would
work.)
On what OS? I have it on XP and some results for Mac OSX.

XP SP2. I must be missing something. For example:

document.getElementsByTagName('p')[0].innerHTML = 'Woof!';

...works just fine in Firefox 1.5.0.11. I guess more specifically though:

first_p = document.getElementsByTagName('p')[0];
first_p.innerHTML = '<script src="innerHTML.js" type="text\/javascript"><\/script>';

Whilst the first P does have the updated innerHTML, it does not allow access to that
script's contents. Bummer.

OK, maybe I am not missing anything. Heh.
The innerHTML button inserts a script block into a div element and
attempts to load a .js file. If it works, you get an alert. That is all
it is testing, not a support for innerHTML itself. I wouldn't expect a
browser in the future to support it unless something comes about where
enough people start complaining about ajax apps with script blocks in
them not getting executed causes the browser people to make it start
executing scripts inserted via innerHTML. That column is left there more
for historical reasons than anything. Mostly historical in the sense
that I wasted so much of my time compiling that data on it that I don't
want to delete it :)

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 21 '07 #10

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

Similar topics

15
by: shyren | last post by:
Hi All, I have a php program which calls a c++ program using exec. However when user presses stop button in the browser or closes it this program keeps on running on the server. How can I stop it...
1
by: CK | last post by:
Need a piece of advice on allocation of tablespaces for partitioning We are using a day level range-based approach as our parititiong scheme given that we have data inflows running into 15...
18
by: Jeff Boes | last post by:
I'm sure this is a concept that's been explored here. I have a table (fairly simple, just two columns, one of which is a 32-digit checksum) with several million rows (currently, about 7 million)....
7
by: Jane | last post by:
In Oracle we can partition a table as follows. What is the equivalent in DB2? CREATE TABLE sales_list (salesman_id NUMBER(5), salesman_name VARCHAR2(30), sales_state VARCHAR2(20),...
10
by: shsandeep | last post by:
DB2 V8.2 (not Viper yet and no range partitioning!!) I have created a table T1 (col1, col2) with col1 as the primary key. When I try to create a partitioning key on col2, it gives me error that it...
5
by: rajasekhar | last post by:
Hallo, I am developing a site, and here whats the problem is: how to partition the code, i.e. if I developed 1000 lines of code, in that I want to show first 200 lines only if the user opens my...
0
by: brunodamato | last post by:
I have 2 questions regarding DB2 9's Range Partitioning. 1. Do the Partition fields have to reside on the table being Partitioned? We have a Fact table we would like to Partition and the...
15
by: Piero 'Giops' Giorgi | last post by:
Hi! I have a question: I already have a DB that uses partitions to divide data in US Counties, partitioned by state. Can I use TWO levels of partitioning? I mean... 3077 filegroups and...
5
by: Camille Petersen | last post by:
I have a rather old VisualBasic program which is included inside an Access *.mdb database. So I guess it is an VisualBasic and not and VBA program. Can I somehow automatically convert it into a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.