![]() | |
![]() |
| | Thread Tools | Display Modes |
#31
| ||||
| ||||
|
|
Ok Randy, You have a credit inside my code update. |
|
Last line, that doesn't require above clear function and it should be cross-browser enough to forget this problem, could You confirm it?http://www.devpro.it/code/163.html |
|
Sorry for my self-packing obsession, however if someone is interested about source, just indent (beautyfing) them, it should be quite clear to read / understand :-) |
|
(evalScript = function(e) { var h = evalScript.node, s = document.createElement("script"); s.type = "text/javascript"; s.text = e; h.appendChild(s); h.removeChild(s); }).node = document.getElementsByTagName("head")[0] || document.getElementsByTagName("*")[0]; // self packed, (more) cross browser/platform alternative // Special thanks to Randy Webb [comp.lang.javascript] (function() { var head = document.getElementsByTagName("head")[0] || document.getElementsByTagName("*")[0]; evalScript = /webkit|khtml|shiira|sunrise/ i.test(navigator.userAgent) ? function(E) { var s = document.createElement('script'); s.type = "text/javascript"; s.appendChild(document.createTextNode(E)); head.appendChild(s); head.removeChild(s); } : ! /icab|ie 5\.2/i.test(navigator.userAgent) ? function(E) { var s = document.createElement('script'); s.type = 'text/javascript'; s.text = E; head.appendChild(s); head.removeChild(s) } : function(E) { var div = document.createElement("div"), style = div.style; style.position = "absolute"; style.border = style.height = style.left = style.top = style.width = "0px"; head.appendChild(div); evalScript = function(e) { div.innerHTML = '<script type"text/javascript">'+ E + '</script>'; divr.emoveChild(div.firstChild) }; evalScript(E) } })(); |
#32
| |||
| |||
|
|
On Aug 31, 4:07 am, Randy Webb <HikksNotAtH... (AT) aol (DOT) com> wrote: But it does *not* work in 7 mac browsers (and that is only the ones I know about). as I've said, I don't have Mac and I don't care, |
|
usually, on browser used by 0.01% of net surfers. |
|
However, thank You for your link, it seems that my basic proposal, that I've never called perfect but I called them *proposal*, need just a simple try catch or to be wrote differenlty for iCab and others using TextNode, really simple, isn't it? Well done, I'll update my code ... so, at this point, totally amount of 2 hours against 7 years? :P |
#33
| ||||||
| ||||||
|
|
I'm curious if he wants credit in your code. Since He spent much more time than me to try to solve this problem, I |

|
"cross-browser enough"? Script insertion is only multi-browser. probably my bad english doesn't allow me to explain perfectly my |
|
In addition to the brittle dependence on navigator.userAgent, I see at least two superficial bugs. I found one, bad replacement (function(e) instead of E) ... now, |
|
as I've said, I don't have Mac and I don't care, That is an unexpected attitude for a professional. come on guys, I wrote JSL many times ago ... so please don't teach me |
|
usually, on browser used by 0.01% of net surfers. This is definitely way off. .... |
|
But where did your two hours get you? two hours to: write code, do few tests with "every day" browsers, |

#34
| |||
| |||
|
#35
| ||||||
| ||||||
|
|
On Aug 31, 4:07 am, Randy Webb <HikksNotAtH... (AT) aol (DOT) com> wrote: How do you debug code that doesn't exist anymore? There are more reasons to leave it than there are to remove it. It is a choice. I choose to leave mine. my debugger works fine and DOM is not persintently incremented Say again? How is me putting script blocks inside a sole div element obtrusive for every other script? just think about document.getElementsByTagName("script") ... and just think about DOM incrementation |
|
The only possible problem that could *ever* be caused by it is if a div element happened to be duplicated in which case the script (mine) could be modified to create it's own div element to use. there are more problems than one ... but leave your personal DIV there if You feel lucky. Use this practice at your own risk if You use third party libraries. |
|
What is foolproof on a PC is to set the .text property of a script element. Trying to do that on other OS'es is a recipe for disaster. disaster ... LOL!!! |
|
But it does *not* work in 7 mac browsers (and that is only the ones I know about). as I've said, I don't have Mac and I don't care, usually, on browser used by 0.01% of net surfers. |
|
However, thank You for your link, it seems that my basic proposal, that I've never called perfect but I called them *proposal*, need just a simple try catch or to be wrote differenlty for iCab and others using TextNode, really simple, isn't it? |
|
Well done, I'll update my code ... so, at this point, totally amount of 2 hours against 7 years? :P |
#36
| |||
| |||
|
|
Ok Randy, You have a credit inside my code update. |
|
Last line, that doesn't require above clear function and it should be cross-browser enough to forget this problem, could You confirm it? http://www.devpro.it/code/163.html |
|
Sorry for my self-packing obsession, however if someone is interested about source, just indent (beautyfing) them, it should be quite clear to read / understand :-) |
#37
| |||
| |||
|
|
On Aug 31, 1:51 am, andrea.giammar... (AT) gmail (DOT) com wrote: Ok Randy, You have a credit inside my code update. I'm curious if he wants credit in your code. |
|
In addition to the brittle dependence on navigator.userAgent, I see at least two superficial bugs. |

#38
| |||||
| |||||
|
|
On Aug 31, 4:16 pm, Peter Michaux <petermich... (AT) gmail (DOT) com> wrote: I'm curious if he wants credit in your code. Since He spent much more time than me to try to solve this problem, I add his credits in my code. If He doesn't want its credits, I'll remove instantly ... He should just tell me ... I don't need his name in my little, personal, site ... so I can't see where the problem is and credits was add just for that "big" browser list and their behaviour ![]() |
|
In addition to the brittle dependence on navigator.userAgent, I see at least two superficial bugs. I found one, bad replacement (function(e) instead of E) ... now, please tell me where's the other. P.S. brittle dependence, rotlf, sounds like Randy "disaster with text" ... I write code for Web surfers, do You write code for crackers? |
|
as I've said, I don't have Mac and I don't care, That is an unexpected attitude for a professional. come on guys, I wrote JSL many times ago ... so please don't teach me how much could be cross-browser a script. |
|
I'm simply realistic, in real life/job/world, 0.01% of bad browser choice can't be my problem. |
|
But where did your two hours get you? two hours to: write code, do few tests with "every day" browsers, write post on personal blog, read here (thanks You Peter) ... and finally, create self-packed cross-browser version. Can You do better? I hope so ![]() |
#39
| |||
| |||
|
|
ooops, just last note about external JavaScript injection .... I wrote this post many months ago. What kind of browser doesn't support them? http://webreflection.blogspot.com/20...ic-import.html |
#40
| ||||||||||||
| ||||||||||||
|
|
I have already responded to that in two other replies, but please remove my name from that, ummm, "code". done, however, thank You for that table |
|
You don't write code for "web surfers", you write code for "web surfers that use a UA that fits into my little world of browser scripting ability". |
|
Why? You could learn a lot based on what you have written so far. And You could learn a lot on what I written too ;-) |
|
I am curious where you got that 0.01%. Did it come off the top of your head or out of your posterior as it would be about as reliable from one place as the other. http://www.w3schools.com/browsers/browsers_stats.asp |
|
I already have, and will continue to make it even better. That can't be said for your code at the present time because you have already decided that it is as good as it needs to be (even though it isn't even close). I've decieded anything about my code ... it is a proposal, just |
|
My script code is no more obtrusive than any other script block. Do you remove the script element that you use to contain your script block also? And, if you know that the script element is there (because you put it there) then you know you have to deal with it. of course ... but don't You never think about other developers that |
|
I don't. Most are written by the kind of people that believe that your script is a solution to the problem at hand. because it's a solution for 98% (ok, ok ... 99.9 is too much ...) of |
|
You mean that garbage, err code, that relies on navigator.userAgent that sends Safari3 on Windows down the wrong path? Uh? last script (and probably first one too) works with Safari 2 too, |
|
And I have code that is 99% fail proof, you have code that is 50% fail proof. 50% of browsers ... but 98% of surfers |
|
If you want to know if something works or not, you could test it yourself. That's what I do everytime |
|
Since you don't care about any non-PC browser what does it matter? This is your opinion, not my way to code (and I've recently bought
|
|
Besides, it would be trivial to answer you if you would make all the code for it easily available rather than having to wade through 4 or 5 pages to find it. No thanks. eh eh ... ok Randy, You are the one! |
![]() |
| Thread Tools | |
| Display Modes | |
| |