Webmaster Forum


Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

Directory Submission Service   I Sell Pagerank   V7N Directory

Reply
 
LinkBack Thread Tools Display Modes
Old 12-13-2006, 01:38 PM   #1 (permalink)
Contributing Member
 
Join Date: 09-16-06
Posts: 87
iTrader: 0 / 0%
Latest Blog:
None

Alexandro is liked by many
Ajax ,XML and browsers

I have 2 problems:

1.IE, XML and Space

I need to parse something with java script.The problem is how internet explorer understand space?Un example:
Code:
<Li> <index>Li_j</index> <name>Lithium</name> <atomic_number>3</atomic_number> <relative_atomic_mass>6.941000</relative_atomic_mass> <melting_point>180.539993</melting_point> <boiling_point>1342.000000</boiling_point> <density>0.530000</density> <covalent_radius>1.230000</covalent_radius> <atomic_radius>2.050000</atomic_radius> <atomic_volume>13.100000</atomic_volume> </Li> <Na> <index>Li_j</index> <name>Lithium</name> <atomic_number>3</atomic_number> <relative_atomic_mass> </relative_atomic_mass> <melting_point> </melting_point> <boiling_point>1342.000000</boiling_point> <density>0.530000</density> <covalent_radius>1.230000</covalent_radius> <atomic_radius>2.050000</atomic_radius> <atomic_volume>13.100000</atomic_volume> </Na>
Look at the bold code.When I parse I need to parse a space.
I select a radio button and put in a div : 180.539993 the value for melting point from Li.When I select another radio button I need to put in the same div a space, but is not doing to do that, it keep the previous and give me a java script error.
Yes I can put another value and tested and when I parse this value to put space instead in div, but I have to do many modifications to code and that is not realy a option.My question is what to put in the XML
<melting_point>SPACE</melting_point> that IE consider it a space?
I try to us the
Code:
&#32 and &nbsp and &amp32
and is not working

2.Ajax and Browser Cache

When I request a particular web page, the browser first tries to load the page from its cache, rather than submitting a new HTTP request.

If I use a php url I wil use something like this
Code:
myRandom=parseInt(Math.random()*99999999); myRequest.open("GET", url + myRandom, true);
or I use the current timestamp
Code:
myRand= + new Date().getTime();
But the problem is I parse with java scripts text and xml files(url) not php and the trick above is not working with this kind of file.
I can add HTTP headers to the data returned by server-side routines, intended to tell the browser not to cache a particular page,but different browsers have different cache support different header declarations, making it difficult to ensure that pages are not cached.
I cant use "url mod rewrite" in apache because by hosting does not give me acces,
What I can do in this situation ?
Alexandro is offline  
Add Post to del.icio.us
Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links
Old 12-13-2006, 04:30 PM   #2 (permalink)
Inactive
 
StupidScript's Avatar
 
Join Date: 09-22-06
Location: Los Angeles
Posts: 678
iTrader: 0 / 0%
Latest Blog:
None

StupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really nice
Code:
&#32 and &nbsp and &amp32
should each have a semi-colon at the ends (i.e. &nbsp; ).

About the caching problem, it looks like the request should be unique every time, so how is it that they are being drawn from the cache at all?
StupidScript is offline  
Add Post to del.icio.us
Reply With Quote
Old 12-13-2006, 05:12 PM   #3 (permalink)
Contributing Member
 
Join Date: 09-16-06
Posts: 87
iTrader: 0 / 0%
Latest Blog:
None

Alexandro is liked by many
1.Well I use the semicolon ";" in XML, I just not writed in the post

2.I use Ajax so I only get and put data in the XML.I am not reload the all page like in php,it is the same page,url,sesion only some data,text is change.

All browsers maintain a so-called cache of visited web pages, a local record of page contents stored on the hard disk of the browser's computer. When you request a particular web page, the browser first tries to load the page from its cache, rather than submitting a new HTTP request.This appears to be more of a problem with IE and browser based on IE than with the non-Microsoft browsers. Only GET requests are affected; POST requests are not cached.
Why browsers do that, I dont know maybe we should ask Microsoft and the others.This is kind of s..t because every browser have a style to treat XML.

Last edited by Alexandro : 12-13-2006 at 05:16 PM.
Alexandro is offline  
Add Post to del.icio.us
Reply With Quote
Old 12-13-2006, 05:46 PM   #4 (permalink)
Inactive
 
StupidScript's Avatar
 
Join Date: 09-22-06
Location: Los Angeles
Posts: 678
iTrader: 0 / 0%
Latest Blog:
None

StupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really nice
Re: space

Can you use some character string instead of a space, like "ggggg" and programmatically replace it with a space on rendering (i.e. PHP's str_replace("ggggg"," ",$xmloutput))?

Re: caching

Yes, thank you. The way the caching process is supposed to work is that the browser compares the timestamp of the page being requested with that of the one in its cache. If the page on the server is newer than the one in the cache, it's supposed to grab the new page. If they have the same timestamp, re-using the cached page saved a lot of bandwidth for dial-up users back in the day when 1200 baud was a kickass connection.

But, again, the code you posted (or something like it) should result in a unique request that would not have been matched by anything in the browser's cache due to your use of the randomizer, whether you used Javascript or PHP or whatever. What is your guess as to why it is being drawn from the cache in the first place? It's a "new", unique request.

If you are not requesting an actual page, but just some data, then why would the browser even cache the data in the first place? I suspect you _are_ requesting a page, even though the data contained in that page is dynamic.

Furthermore, piping that request through the XMLHttpRequest mechanism should remove any question in the browser's mind that the request must be gotten from the server each time. How are you implementing your AJAX request initialization?
StupidScript is offline  
Add Post to del.icio.us
Reply With Quote
Old 12-14-2006, 03:34 AM   #5 (permalink)
Contributing Member
 
Join Date: 09-16-06
Posts: 87
iTrader: 0 / 0%
Latest Blog:
None

Alexandro is liked by many
The timestamp work if the url is a php script(file) but if i get a xml.file is not working;
I have 50 diferent elements in total 1000 elements in a for then in a switch, because the change are determined by user and it is a coding problem because I have to write for every switch a function specific.
Alexandro is offline  
Add Post to del.icio.us
Reply With Quote
Old 12-14-2006, 04:41 PM   #6 (permalink)
Inactive
 
StupidScript's Avatar
 
Join Date: 09-22-06
Location: Los Angeles
Posts: 678
iTrader: 0 / 0%
Latest Blog:
None

StupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really nice
What about making the request for a PHP page with various parameters and having the PHP generate the XML file that is returned? It doesn't need the .xml extension, as long as the headers are correct. It sounds like you are describing a problem with MSIE's recognizing a valid format or something like that.

Does this look like the XMLHttpRequest initialization you are using?
Code:
var http_request = false; if (window.XMLHttpRequest) { http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType('text/xml'); } } else if (window.ActiveXObject) { try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } }
You can use http_request.send("param1=value1&param2=value2"); to pass the parameters to the page you're GETting.
StupidScript is offline  
Add Post to del.icio.us
Reply With Quote
Old 12-14-2006, 04:58 PM   #7 (permalink)
Contributing Member
 
Join Date: 09-16-06
Posts: 87
iTrader: 0 / 0%
Latest Blog:
None

Alexandro is liked by many
It is similar:
Code:
function gXMLHTTPRequest() { var req = false; try { req = new XMLHttpRequest(); /* e.g. Firefox */ } catch(err1) { try { req = new ActiveXObject("Msxml2.XMLHTTP"); /* some versions IE */ } catch(err2) { try { req = new ActiveXObject("Microsoft.XMLHTTP"); /* some versions IE */ } catch(err3) { req = false; } } } return req; } var myRequest = getXMLHTTPRequest();
but I resolved the problem because In my case I can use " - " instead of " ",
but for other aplications remains an option
Alexandro is offline  
Add Post to del.icio.us
Reply With Quote
Old 12-15-2006, 12:29 PM   #8 (permalink)
Inactive
 
StupidScript's Avatar
 
Join Date: 09-22-06
Location: Los Angeles
Posts: 678
iTrader: 0 / 0%
Latest Blog:
None

StupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really nice
Cool. So, using the hyphen instead of the space, does that just solve the space issue, or is it also helping with the caching issue?
StupidScript is offline  
Add Post to del.icio.us
Reply With Quote
Old 12-15-2006, 01:31 PM   #9 (permalink)
Contributing Member
 
Join Date: 09-16-06
Posts: 87
iTrader: 0 / 0%
Latest Blog:
None

Alexandro is liked by many
With the white space only , but in other situation maybe I will be bound to use white space instead - so the question remains.
Alexandro is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Browsers jg_v7n Computers & Internet 3 07-24-2007 04:28 AM
AJAX: bots hitting AJAX scripts kkiely Coding Forum 1 04-21-2007 01:14 AM
Different Results with Different Browsers ArturK Google Forum 3 09-16-2006 02:13 PM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 10:54 PM.
© Copyright 2008 V7 Inc