Quantcast

[Moo] Attempting to dynamically load Compat Inspector using MooTools 1.4.5/1.4

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Moo] Attempting to dynamically load Compat Inspector using MooTools 1.4.5/1.4

Jack Drysdale Jr
Hello, everyone.

I am attempting to dynamically load Microsoft's "IE 10 Compat Inspector" - based upon login (users shouldn't see it; developers should).  We are using MooTools Core 1.4.5 and More 1.4.

The document I am working on and compat inspector are one directory past webroot, the index.cfm (which will be the document to display Compat Inspector) is in webroot.

Here's my code:
<!---  IF login is developer --->
  <script type="text/javascript">
    try{
      var pHead = parent.document.head;
      var newScript = new Element('script',{
        type: 'text/javascript',
        src: 'ie10inspector.js'
        });
      newScript.inject(pHead,'top');
      }
    catch(e){
      alert("didn't work"); // to be removed before production
      }
  </script>
<!--- END IF --->

It works in FF21, FF23, and Chrome.  It is not working in IE7, 8, or 10.  Any suggestions?

Thank you,

JD

--
 
---
You received this message because you are subscribed to the Google Groups "MooTools Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Moo] Attempting to dynamically load Compat Inspector using MooTools 1.4.5/1.4

Sanford Whiteman
> It is not working in IE7, 8, or 10.  Any suggestions?

(1) What is the actually error in IE (8, for example)? Using SEH makes
it impossible for you to get errors logged to the console... try-catch
is fine for production but is only hindering you here. I'd need to
know where it says it's throwing up to see if I can get that same
error (given the lack of a demo page).

(2) iecompat.js isn't supposed to be loaded after other scripts: "Run
Compat Inspector by adding the following script before all other
scripts on each page you want to test (the need to run before other
scripts means Compat Inspector can't be used as a bookmarklet):"
Microsoft specifically advises using a proxy to inject this content at
the top rather than (as I presume you're doing) injecting it in the
browser.

(3) iecompat.js throws console errors out in my IE 8 even when it's
explicitly present in HEAD, so I don't consider this a particularly
promising starting point!

-- Sandy

--

---
You received this message because you are subscribed to the Google Groups "MooTools Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Moo] Attempting to dynamically load Compat Inspector using MooTools 1.4.5/1.4

Jack Drysdale Jr
1- Since it was never meant to run under anything less than IE9, I get a "'inspector.source' is null or not an object" message.. that's it.  Even when hard-coded into the HEAD tag.

2- I realize that; I've read the instructions before downloading it and setting up a local copy to work with.  I'm putting it very first after opening <head> tag and before a <meta> tag.  And I was under the impression that newScript.inject(pHead,'top') would put it at the very top of the childNodes for HEAD.  (I originally tried the reverse - hard code the inspector, then "null" it if the user wasn't a developer.. that obviously didn't work.)

3- The only reason I'm still pursuing this line is because it works flawlessly in FF/Chrome (it even animate/slides in from the side in FF/Chrome, but not in IE.)  It's my understanding that FF and Chrome will load things in a specific order, but IE not always.  This could be that kind of issue.

JD


On Wednesday, October 2, 2013 1:29:09 PM UTC-5, Sanford Whiteman wrote:
> It is not working in IE7, 8, or 10.  Any suggestions?

(1) What is the actually error in IE (8, for example)? Using SEH makes
it impossible for you to get errors logged to the console... try-catch
is fine for production but is only hindering you here. I'd need to
know where it says it's throwing up to see if I can get that same
error (given the lack of a demo page).

(2) iecompat.js isn't supposed to be loaded after other scripts: "Run
Compat Inspector by adding the following script before all other
scripts on each page you want to test (the need to run before other
scripts means Compat Inspector can't be used as a bookmarklet):"
Microsoft specifically advises using a proxy to inject this content at
the top rather than (as I presume you're doing) injecting it in the
browser.

(3) iecompat.js throws console errors out in my IE 8 even when it's
explicitly present in HEAD, so I don't consider this a particularly
promising starting point!

-- Sandy

--
 
---
You received this message because you are subscribed to the Google Groups "MooTools Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Moo] Attempting to dynamically load Compat Inspector using MooTools 1.4.5/1.4

Sanford Whiteman
> 1- Since it was never meant to run under anything less than IE9, I
> get a "'inspector.source' is null or not an object" message.. that's
> it.  Even when hard-coded into the HEAD tag.

You didn't mention at first that you're trying to run something that's
documented by the developer to _not work_. That's kinda critical info.
What's the error in IE 10?

> 2- I realize that; I've read the instructions before downloading it
> and setting up a local copy to work with.  I'm putting it very first
> after opening <head> tag and before a <meta> tag.  

If there are scripts hard-coded in the HEAD, expect them to have
already run before your script that injects another <SCRIPT> tag.

> And I was under the impression that newScript.inject(pHead,'top')
> would put it at the very top of the childNodes for HEAD.

Sure it puts it at the top, but it wasn't at the top when the page
first loaded, so that's irrelevant! The principal reason to inject
into HEAD is to get a more organized DOM when inspecting it later, not
to somehow turn back time.

> (I originally tried the reverse - hard code the inspector, then "null"
> it if the user wasn't a developer.. that obviously didn't work.)

Nope...

> 3- The only reason I'm still pursuing this line is because it works
> flawlessly in FF/Chrome (it even animate/slides in from the side in
> FF/Chrome, but not in IE.) It's my understanding that FF and Chrome
> will load things in a specific order, but IE not always. This could
> be that kind of issue.

It's an issue of asynchronous loading, of course (that's why it
doesn't see inspector.source, because an inspector object hasn't been
instantiated yet and the source property is only added when the
function runs) but I don't see uch utility in fighting to get
something to run that may not even correctly report the compatibility
errors it's supposed to catch (I could well get it to load n IE 8 but
give you flawed results).

I can look at it more later, have to go over to Interop for a bit...

-- S.

--

---
You received this message because you are subscribed to the Google Groups "MooTools Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Moo] Attempting to dynamically load Compat Inspector using MooTools 1.4.5/1.4

Jack Drysdale Jr
According to another developer that I've been asking about this: "IE has no event order management system, it is totally random."

So the one browser that this needs to work in doesn't have the capability to make it work; at least, not for specific people, just all or none.

I hate IE.

Thank you for your time.  I'm giving up on this.

JD

--
 
---
You received this message because you are subscribed to the Google Groups "MooTools Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Moo] Attempting to dynamically load Compat Inspector using MooTools 1.4.5/1.4

Sanford Whiteman
> According to another developer that I've been asking about this:
> "IE has no event order management system, it is totally random."

That is (a) an overstatement and (b) may not be relevant to this
issue. You have no proof that it has to do with event firing order, do
you? Just pointing out something that IE has trouble with doesn't mean
that's the trouble here.

> Thank you for your time.  I'm giving up on this.

I thought you didn't like it when people walk away.

I'm still working on it, now that you got us started.

-- S.

--

---
You received this message because you are subscribed to the Google Groups "MooTools Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Moo] Attempting to dynamically load Compat Inspector using MooTools 1.4.5/1.4

Jack Drysdale Jr
I placed an alert before the code that just displays the word "loaded".

In FF/Chrome, before the page is done loading a js alert pops open with the word "loaded" and will load the rest of the page THEN the Compat Inspector after "OK" is clicked.

In IE 7-10, before the page is done loading a js alert pops open with the word "loaded" and then does everything BUT load the Compat Inspector after "OK" is clicked.

Overstatement or no, I've spent way too much time on this, already, and just for a compatibility tester that (admittedly) would be nice to have, but isn't mission-critical.  Yes, my personal curiosity is piqued, but I'm not wasting any more time with it.. hours that I will never get back.

If you want to pursue it further, I understand, and thanks for your time.  But I'm moving on to the next project.

JD

--
 
---
You received this message because you are subscribed to the Google Groups "MooTools Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Moo] Attempting to dynamically load Compat Inspector using MooTools 1.4.5/1.4

Sanford Whiteman
The problem turns out to have nothing to do with event triggering
order (nor with any quirk that isn't widely known about IE).

All you actually needed to do was

• comment out the check that begins "// Ensure pre-requisites are supported" on Line 18

• any line that calls addEventListener needs to call attachEvent

• should also comment out Line 119: // if(inspector.config.hide) delete window.inspector;

With these changes I can see the inspector UI in IE 8. Its
compatibility report is highly questionable, as you should well
expect.

-- S.



       

--

---
You received this message because you are subscribed to the Google Groups "MooTools Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Loading...