Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #14495

Re: JS injection in Firefox

From Shelly <sheldonlg@thevillages.net>
Newsgroups comp.lang.javascript
Subject Re: JS injection in Firefox
Date 2012-06-13 21:54 -0400
Organization A noiseless patient Spider
Message-ID <jrbg91$i30$1@dont-email.me> (permalink)
References <jraipo$rbk$1@dont-email.me> <4fd8e02a$0$6983$e4fe514c@news2.news.xs4all.nl> <jrapsb$c8i$1@dont-email.me> <XnsA071E02544D6Eeejj99@194.109.133.133> <jravv5$nq4$1@news.albasani.net>

Show all headers | View raw


On 6/13/2012 5:16 PM, Stefan Weiss wrote:
> On 2012-06-13 22:02, Evertjan. wrote:
>> Shelly wrote on 13 jun 2012 in comp.lang.javascript:
>>> On 6/13/2012 2:47 PM, Tom de Neef wrote:
>>>> Two days ago, Steafn Weiss answered Jason C in this NG (I don't know
>>>> how to get the ref):
>>>> ...the answer is that scripts inserted with innerHTML are never
>>>> evaluated. ...An ... option would be to scan the inserted HTML for
>>>> script elements and manually evaluate them.
> ...
>>> I found that one.  It said that they are never evaluated.  That is not
>>> true.  My return uses innerHTML, is a javascript that is returned, and
>>> evaluates in Internet Explorer.  It used to (Feb. 2008 version) in
>>> Firefox, but now it doesn't.
>>
>> Does not work in IE9, I cannot believe it ever did.
>
> This page from the IE API reference
> <http://msdn.microsoft.com/en-us/library/ie/ms533897%28v=vs.85%29.aspx>
> has the following information:
>
> | When using innerHTML to insert script, you must include the DEFER
> | attribute in the script element.
>
> If Shelly's code used defer, it's possible that the script was indeed
> evaluated in IE. I can't explain how it could have worked in Firefox in
> 2008, though. It couldn't have been the defer attribute, because support
> for that was only introduced in Firefox 3.5 (and for a different purpose).
>
> In any case, DEFER doesn't do anything for scripts inserted with
> innerHTML in current versions of Firefox or Chrome. Shelly, if you want
> to support other browsers than IE, I still refer you to my previous post
> in the thread "XMLHttpRequest, using setTimeout() from within child". Or
> you could show us the code that worked in Firefox in 2008. Maybe there's
> something else going on.
>
> - stefan

I can't show the code (company policy).  I wrote this app starting in 
Jan 2008.  Nothing at all has changed in the code.  I used Firefox to 
develop it because of its Firebug tool.  The browser problems I had at 
that time was making all the features work properly in IE.  For example, 
I put up a popup box that stays fixed in position on the screen even 
when scrolling the window behind the pop-up.  That was a devil to get 
working properly in IR.

Now the company wants to use this again (they hadn't for a a few years). 
  So, I went to see if it still worked.  It does in IE, but not in 
Firefox.  Again, nothing has changed in the interim.

Here is what is returned from the server: 
[{"action":"assign","id":"navbar","attributes":{"innerHTML":"<script 
type='text\/javascript'> var menu = new 
DHTMLSuite.menuModel();menu.addItem('1', 'Main Menu', , , 
false);menu.setSubMenuWidth('1',230);menu.addItem('11', 'pccr', , , 
'1');menu.setSubMenuWidth('11',230);menu.addItem('111', 'Master 
Configuration', , , 
'11');menu.setSubMenuWidth('111',230);menu.addItem('1111', 'Supplier 
Configuration', , , '111', , \"ajaxCall('pccr', 
'SupplierConfigurationController', 'initialize', , 
'dummyCallback')\");menu.addItem('1112', 'Dimension Configuration', , , 
'111', , \"ajaxCall('pccr', 'DimensionConfigurationController', 
'initialize', , )\");menu.addItem('1113', 'Responsible Person', , , 
'111', , \"ajaxCall('pccr', 'ResponsiblePersonConfigurationController', 
'initialize', , )\");menu.addItem('1114', 'Indirect Contracts', , , 
'111', , \"ajaxCall('pccr', 'IndirectContractsController', 'initialize', 
, )\");menu.addItem('1115', 'InterCompany Configuration', , , '111', , 
\"ajaxCall('pccr', 'InterCompanyConfigurationController', 'initialize', 
, )\");menu.addItem('112', 'Current Period Review', , , '11', , 
\"ajaxCall('pccr', 'CurrentPeriodReviewController', 'initialize', , 
)\");menu.addItem('113', 'PCCR History', , , '11', , \"ajaxCall('pccr', 
'PccrHistoryController', 'initialize', , )\");menu.init(); var menuBar2 
= new 
DHTMLSuite.menuBar();menuBar2.addMenuItems(menu);menuBar2.setTarget('navbar');menuBar2.init();<\/script>"}}] 


This is what is sent back by both IE and Firefox.  The result is a drop 
down menu system in IE and a null in Firefox.

-- 
Shelly

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

JS injection in Firefox Shelly <sheldonlg@thevillages.net> - 2012-06-13 13:31 -0400
  Re: JS injection in Firefox "Tom de Neef" <tdeneef@qolor.nl> - 2012-06-13 20:47 +0200
    Re: JS injection in Firefox Shelly <sheldonlg@thevillages.net> - 2012-06-13 15:32 -0400
      Re: JS injection in Firefox "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-06-13 20:02 +0000
        Re: JS injection in Firefox Stefan Weiss <krewecherl@gmail.com> - 2012-06-13 23:16 +0200
          Re: JS injection in Firefox Shelly <sheldonlg@thevillages.net> - 2012-06-13 21:54 -0400
            Re: JS injection in Firefox Stefan Weiss <krewecherl@gmail.com> - 2012-06-14 05:28 +0200
              Re: JS injection in Firefox Shelly <sheldonlg@thevillages.net> - 2012-06-14 08:17 -0400
    Re: JS injection in Firefox Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-06-15 00:55 +0200

csiph-web