Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #23866 > unrolled thread
| Started by | dhunziker@wide-design.ch |
|---|---|
| First post | 2014-04-13 19:07 -0700 |
| Last post | 2014-04-14 22:29 +0000 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.lang.javascript
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: How to make injected js execute? dhunziker@wide-design.ch - 2014-04-13 19:07 -0700
Re: How to make injected js execute? JJ <duh@nah.meh> - 2014-04-14 11:08 +0700
Re: How to make injected js execute? Denis McMahon <denismfmcmahon@gmail.com> - 2014-04-14 22:29 +0000
| From | dhunziker@wide-design.ch |
|---|---|
| Date | 2014-04-13 19:07 -0700 |
| Subject | Re: How to make injected js execute? |
| Message-ID | <91b5004f-aad9-453d-9904-1705a838352d@googlegroups.com> |
What if i load a file with a ajax query in it. Then the ajax is not excuted leaving no errormessage.
On Sunday, August 19, 2007 11:01:25 PM UTC+3, Jon Maz wrote:
> Hi,
>
> I've got a simple bit of code that successfully injects a javascript alert
> into the DOM (confirmed by View Generated Source in Firefox), yet that alert
> is not executed.
>
> QUESTION: Why doesn't it execute?
> QUESTION: Can I make it execute?
>
> <html>
> <body>
>
> <div id="myDiv"></div>
>
> <script>
> var myDiv = document.getElementById("myDiv");
> myDiv.innerHTML = "\<script\>alert('foo');\</script\>";
> </script>
>
> </body>
> </html>
>
> Thanks in advance,
>
> JON
[toc] | [next] | [standalone]
| From | JJ <duh@nah.meh> |
|---|---|
| Date | 2014-04-14 11:08 +0700 |
| Message-ID | <12me5pzzfnxht.ybgh1e8u28jb$.dlg@40tude.net> |
| In reply to | #23866 |
On Sun, 13 Apr 2014 19:07:33 -0700 (PDT), dhunziker@wide-design.ch wrote:
> What if i load a file with a ajax query in it. Then the ajax is not excuted leaving no errormessage.
>
> On Sunday, August 19, 2007 11:01:25 PM UTC+3, Jon Maz wrote:
>> Hi,
>>
>> I've got a simple bit of code that successfully injects a javascript alert
>> into the DOM (confirmed by View Generated Source in Firefox), yet that alert
>> is not executed.
>>
>> QUESTION: Why doesn't it execute?
>> QUESTION: Can I make it execute?
>>
>> <html>
>> <body>
>>
>> <div id="myDiv"></div>
>>
>> <script>
>> var myDiv = document.getElementById("myDiv");
>> myDiv.innerHTML = "\<script\>alert('foo');\</script\>";
>> </script>
>>
>> </body>
>> </html>
>>
>> Thanks in advance,
>>
>> JON
The SCRIPT tag's code won't be loaded/executed if the SCRIPT tag is inserted
using innerHTML. You'll have to set the script code after the SCRIPT element
object existed, by using its innerHTML or textContent.
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2014-04-14 22:29 +0000 |
| Message-ID | <lihngc$3ll$1@dont-email.me> |
| In reply to | #23866 |
On Sun, 13 Apr 2014 19:07:33 -0700, dhunziker wrote: > What if i load a file with a ajax query in it. Then the ajax is not > excuted leaving no errormessage. Firstly, it would be much more useful if you started a new thread instead of tagging your comment onto a 7 year old post. Secondly, we tend to read down the page, so please put any comments you make /*_BELOW_*/ the text they refer to. Thirdly, please include an example of the code that seems to not be working, and details of what tests you've done. For example, you say the ajax isn't executed. Do the server logs confirm this, or do they show some sort of malformed request has been received, or possibly that there is an error server side whilst processing the ajax request? Did you copy the ajax code from another site or script, or write it from scratch yourself? There are a lot of examples of ajax code out there, some are more robust than others. How are you passing parameters from the ajax call to the server script? How are you passing the response back? Is it possibly an encoding or data confusion issue? -- Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web