Skip to main content
Topic: if (typeof(window.XMLHttpRequest) != "undefined") (Read 7447 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

if (typeof(window.XMLHttpRequest) != "undefined")

From what I read around this is for IE 5 and 6, am I wrong?
Bugs creator.
Features destroyer.
Template killer.

Re: if (typeof(window.XMLHttpRequest) != "undefined")

Reply #1

Thats correct ... I think ie7+ has window.XMLHttpRequest availalble ... I've been lazy about yanking that one out, feel free (you know you want to) :D

Re: if (typeof(window.XMLHttpRequest) != "undefined")

Reply #2

Code: [Select]
// Some older versions of Mozilla don't have this, for some reason.
if (!('forms' in document))
document.forms = document.getElementsByTagName('form');

 emanuele wonders what "old" means...

ETA: it was introduced between beta 3 and RC2 (didn't test in between), so it should be a fairly old (i.e. < firefox 3.5)

 emanuele removes it as well

https://github.com/elkarte/Elkarte/pull/1181
Last Edit: December 21, 2013, 01:58:13 pm by emanuele
Bugs creator.
Features destroyer.
Template killer.

Re: if (typeof(window.XMLHttpRequest) != "undefined")

Reply #3

Don't want to open another topic, so I'll put it here.

From Auth.controller.php:
Code: [Select]
elseif (!empty($_SESSION['logout_url']) && (strpos('http://', $_SESSION['logout_url']) === false && strpos('https://', $_SESSION['logout_url']) === false))
headscratch

shouldn't be:
Code: [Select]
strpos($_SESSION['logout_url'], 'http://')
and
Code: [Select]
strpos($_SESSION['logout_url'], 'https://')

???
Bugs creator.
Features destroyer.
Template killer.

Re: if (typeof(window.XMLHttpRequest) != "undefined")

Reply #4

Also in OpenID.subs.php, function canonize:
Code: [Select]
		if (strpos(substr($uri, strpos($uri, '://') + 3), '/') === false)
$uri .= '/';
What is supposed to do that piece of code?
Add a / at the end of the url?
Bugs creator.
Features destroyer.
Template killer.

Re: if (typeof(window.XMLHttpRequest) != "undefined")

Reply #5

Sure seems backwards ... thats only going to be true if $_SESSION['logout_url'] equals http(s)://
Quote from: emanuele – Also in OpenID.subs.php, function canonize:
Code: [Select]
		if (strpos(substr($uri, strpos($uri, '://') + 3), '/') === false)
$uri .= '/';
What is supposed to do that piece of code?
Add a / at the end of the url?
Looks that way, starts searching after the http(s):// stuff and if it does not find any / it adds one ... but xyz.abc.com/bla would pass that check I think.  If it just want to make sure there is always a trailing / then a substr -1 may be more understandable check.

Re: if (typeof(window.XMLHttpRequest) != "undefined")

Reply #6

Well I'm thinking about it ... I know there were a few other places that we needed to do a http(s)? check, we added a couple a while back but I think there were a few more on the todo list.  Can't find the github issue ATM but I know its buried in one of the comments when the issue first came up and the immediate problem child was fixed.

Also  :D  since we are removing that XMLHttpRequest  thing, there is some old code in the quotefast function that should be removed as well (at least I think) ... There was some none XMLHttpRequest work around that opened a new browser window with the quote and then grabbed the data from the popup and inserted it in the quick reply, or something along those lines ... pretty sure all that non xml (but still js) stuff can go bye bye.

Re: if (typeof(window.XMLHttpRequest) != "undefined")

Reply #7

Quote from: Spuds –
Quote from: emanuele – From Auth.controller.php:

???
Sure seems backwards ... thats only going to be true if $_SESSION['logout_url'] equals http(s)://
https://github.com/emanuele45/Dialogo/commit/0db15e9ebfb43790f19d9d6be781ac91d4d7608b

Quote from: Spuds –
Quote from: emanuele – Also in OpenID.subs.php, function canonize:
Code: [Select]
		if (strpos(substr($uri, strpos($uri, '://') + 3), '/') === false)
$uri .= '/';
What is supposed to do that piece of code?
Add a / at the end of the url?
Looks that way, starts searching after the http(s):// stuff and if it does not find any / it adds one ... but xyz.abc.com/bla would pass that check I think.  If it just want to make sure there is always a trailing / then a substr -1 may be more understandable check.
Right, I had the impression there was something more, but didn't pay enough attention...
I changed it here:
https://github.com/emanuele45/Dialogo/commit/63cad8dd93258ccc0c934a41c7f07428f0c9dfa7
but I'll revert it and will do in a slightly different way.
Thanks!

Quote from: Spuds – Well I'm thinking about it ... I know there were a few other places that we needed to do a http(s)? check, we added a couple a while back but I think there were a few more on the todo list.  Can't find the github issue ATM but I know its buried in one of the comments when the issue first came up and the immediate problem child was fixed.
I found these:
https://github.com/emanuele45/Dialogo/commit/35cfaa8b1b02e8fcc2b3312e788662686403a1cf
https://github.com/emanuele45/Dialogo/commit/422d2177b5382e05dff6de45ba275c19a541385c
https://github.com/emanuele45/Dialogo/commit/3a513546f3d30cf1a41cd562394d1c03693edc68


Quote from: Spuds – Also  :D  since we are removing that XMLHttpRequest  thing, there is some old code in the quotefast function that should be removed as well (at least I think) ... There was some none XMLHttpRequest work around that opened a new browser window with the quote and then grabbed the data from the popup and inserted it in the quick reply, or something along those lines ... pretty sure all that non xml (but still js) stuff can go bye bye.
mmm... arg...
Well, we can remove them when we found any... O:-)
I have almost no idea where to look... lol
Bugs creator.
Features destroyer.
Template killer.