Wednesday, February 29, 2012

Re: How to load an external JS-file without calling a function in there

Check their API or read their javascript code, there might be a way to pass an id of a div which they would use to append to instead of using document.write.  That's what I found when trying to use Twitter's Widget api, it was documented but I did find it by reading their code and seeing what it does.

On Wednesday, February 29, 2012 9:55:13 AM UTC-5, Thomas Broyer wrote:
Anything relying on document.write() must be in your HTML source when it's being parsed; they can't be loaded dynamically.

On Wednesday, February 29, 2012 2:14:35 PM UTC+1, newnoise wrote:
Hi,

I'm trying to dynamically add advertisement to our page. Our
advertisement-partner provides us a script which we have to include
like this:
<script type="text/javascript" src="http://www.somesource.com/
output.js?id=123
"></script>

The output.js just contains one line of code like this:
document.write("<div>some html</div>");

I have no idea how I can add this JS to the page and make it
execute ... I tried just adding it as a HTML-Widget, which correctly
adds the code, but it isnt executed. Also the ScriptInjection doesnt
help, because I need the code somewhere in the <body> and not in
<head>.

I'm happy for any help!
Tom

On Wednesday, February 29, 2012 9:55:13 AM UTC-5, Thomas Broyer wrote:
Anything relying on document.write() must be in your HTML source when it's being parsed; they can't be loaded dynamically.

On Wednesday, February 29, 2012 2:14:35 PM UTC+1, newnoise wrote:
Hi,

I'm trying to dynamically add advertisement to our page. Our
advertisement-partner provides us a script which we have to include
like this:
<script type="text/javascript" src="http://www.somesource.com/
output.js?id=123
"></script>

The output.js just contains one line of code like this:
document.write("<div>some html</div>");

I have no idea how I can add this JS to the page and make it
execute ... I tried just adding it as a HTML-Widget, which correctly
adds the code, but it isnt executed. Also the ScriptInjection doesnt
help, because I need the code somewhere in the <body> and not in
<head>.

I'm happy for any help!
Tom

On Wednesday, February 29, 2012 9:55:13 AM UTC-5, Thomas Broyer wrote:
Anything relying on document.write() must be in your HTML source when it's being parsed; they can't be loaded dynamically.

On Wednesday, February 29, 2012 2:14:35 PM UTC+1, newnoise wrote:
Hi,

I'm trying to dynamically add advertisement to our page. Our
advertisement-partner provides us a script which we have to include
like this:
<script type="text/javascript" src="http://www.somesource.com/
output.js?id=123
"></script>

The output.js just contains one line of code like this:
document.write("<div>some html</div>");

I have no idea how I can add this JS to the page and make it
execute ... I tried just adding it as a HTML-Widget, which correctly
adds the code, but it isnt executed. Also the ScriptInjection doesnt
help, because I need the code somewhere in the <body> and not in
<head>.

I'm happy for any help!
Tom

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/XswmWnOLrucJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment