Re: Can't refer to innerHTML contents



Erwin Moller said the following on 9/13/2007 5:56 AM:
Randy Webb wrote:
Erwin Moller said the following on 9/12/2007 5:15 AM:
Randy Webb wrote:

<snip>

function loadHTMLFragment(elemId, HTMLFragment)

<snip>


Hi Randy,

Thanks again.
I saved that piece in my libs for future use. ;-)

Since this question (returning javascript via an xmlhttprequest) pops up for everybody who starts with AJAX sooner or later, maybe we should suggest to place this code into the FAQ?

That was the intent when I started working on it. The code needs some more testing (non-PC users). I believe it is going to work anywhere other than iCab and IE/Mac. The only thing that, I believe, needs to be added to it for iCab and IE5.2 is a test to stay out of the function at all since they both execute scripts inserted via innerHTML (or that is what I have been told). I also do not know the usage of those two browsers and whether they are even worth worrying about.

Hi Randy,

IE5 on Mac was really a headache IMHO.
Coward as I am, I just gave up on it a few years ago after a few long frustrating sessions.

Personally, I think IE5.2 on a mac has gone the way of NN4.xx where it is a dead browser. It was replaced in 2003 by Safari as the default Mac browser. No updates since 2000.
<URL: http://en.wikipedia.org/wiki/Internet_Explorer_for_Mac>

I don't have statistics, but I don't expect it is used a lot nowadays.
And ICab?

I don't have a lot of faith in web statistics and that belief is reaffirmed because according to most statistics I can quickly locate using Google puts the mac usage on the entire planet at about 4 users.

iCab is a little different than IE/Mac though as it had a release in 2006 so I wouldn't consider it a dead browser yet, just a hard one to script.
<URL: http://en.wikipedia.org/wiki/ICab>

AS for supporting it, it is no harder to support ICab than it is IE5.2 with regards to script injection. They both will fire script elements inserted via innerHTML (That is with text, never tested it with a .src attribute).

If your code works for all major browsers except these two: well, I say put it in the faq. :-)
I am sure that will make many users happy.

I think it would end up like DynWrite where it has a "majority satisfaction" code in the FAQ itself and then links to a Notes page where the Notes page goes into detail and has a different version. Probably let the FAQ version cover browsers that handle .text and let the Notes version cover any browser where I can make it work.

here maybe?
http://jibbering.com/faq/index.html#FAQ4_44

What do you think?

Subject? I don't have a problem adding it.

"How do I get my AJAX inserted scripts to execute?"

Not the best but a start.

Clear, to the point, subject.

I just don't like the AJAX part of it simply because there are more ways to inject scripts than just AJAX.

I would also prefer it has something to say about the actual problem and that is the backend not being designed for the front end. The problem arises from people simply retrieving documents and inserting them into another document instead of redesigning the back end of a site to make it AJAX compatible.

Yes, some background would certainly help new AJAX users.

That is a different subject though. To me anyway. "I want an AJAX site, what do I need to do?"

If I knew enough about the matter I would offer to help to write a little background. But I don't.

I discovered it by accident actually. I had an AOL account. They would give you webspace. 2mb's with no banner, 20mb's if you allowed an AOL banner. You could have 7 screen names and hot link to them. I was trying to find a way to have a larger personal webpage without having a banner and somehow I ended up at loading .js files so that all I would have to store on the server was the data and not all the other HTML aspects. It started there and ended up here. It wasn't something I set out to try to discover.

I can tell you what I, as a casual user, was thinking, and based on the postings I found on the net about this matter, I think most people had similar expectations:

I remember I was really surprised when I found out it didn't work.

That was actually how I found out. Trying to load a .js file without reloading the page. The ways I found were intriguing (I can do it in NN4.xx for example). That was way back around 1999 or so.

For some (invalid) reason many people expect it to work right away. I think most people see javascript as an intergral part of html (which it isn't of course), and since all text, including all markup, appears just fine after a command like getElementById("..").innerHTML = "bla", they expect the javascript to be interpreted too.

I was surprised the first time I tried it. I got lucky with c.l.j as a place to find out different ways to do it.


Thanks again for the code.
Please put it in the faq someday. :-)

It will end up there, just a matter of when.

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



Relevant Pages

  • Re: Does Macintosh read uppercase?
    ... through any browser. ... "Jim Carlock" wrote: ... > Javascript is supposed to be case-sensitive on all platforms, ... >>>> Does Macintosh read upper and lower case scripts? ...
    (microsoft.public.frontpage.programming)
  • Re: Lisp apps for the iPhone?
    ... means) and AJAX, all based on the Safari browser. ... Maybe Lisp people get some advantage writing JavaScript, ... with Javascript have been a single giant security problem ...
    (comp.lang.lisp)
  • Re: Attempt to de-mystify AJAX
    ... >>> What really bothers me about javaScript is the fact that I can't know ... > I picked this up from the jScript helpfiles ... > IE3 & AJAX) with relative ease, and if you look at practical examples ... of the players in the Browser Wars have seen that things can only be ...
    (comp.databases.pick)
  • Re: Ajax woes
    ... SWEA doesn't block the browser - it could be a very bad idea to ... I have run many complex scripts multiple times inWatirwithout ... As mentioned earlier in the thread, people usingWatirto test Ajax ...
    (comp.lang.ruby)
  • Re: Potential new recruit to Java. Could I/Should I use Java?
    ... AJAX depends on a recent JavaScript being installed and working. ... every browser has its own incompatible version ... Java on the other does not usually come preinstalled, ...
    (comp.lang.java.programmer)

Loading