Re: How-to display a Javascript-Widget (e.g. from tripadvisor) in an GWT HTML Widget?

2013-09-21 Thread marian lux
I found something about "Script Injection" and tried the following code to 
add the script in my HTML page (on EntryPoint - method):

Document doc = Document.get();
ScriptElement script = doc.createScriptElement();
script.setSrc("
http://www.jscache.com/wejs?wtype=cdswritereviewlg&uniq=303&locationId=206597&lang=en_AU&border=true
");
script.setType("text/javascript");
script.setLang("javascript");
doc.getBody().appendChild(script);

and added the other code as String in an HTML-Widget.
But there is the same issue. Only the text: 
"Review Grand Hotel 
Wien
"
appears!

Am Samstag, 21. September 2013 11:21:49 UTC+2 schrieb marian lux:
>
> I want do display e.g. the following widget in an GWT HTML-widget:
>
> 
> 
> Review http://www.tripadvisor.com.au/Hotel_Review-g190454-d206597-Reviews-Grand_Hotel_Wien-Vienna.html";>Grand
>  
> Hotel Wien
> 
> 
> http://www.jscache.com/wejs?wtype=cdswritereviewlg&uniq=303&locationId=206597&lang=en_AU&border=true<http://www.jscache.com/wejs?wtype=cdswritereviewlg&uniq=303&locationId=206597&lang=en_AU&border=true>
> ">
>
>
> The widget id displayed fine here:
> http://www.w3schools.com/html/tryit.asp?filename=tryhtml_intro
>
> But on GWT I don't see the widget. Only the Text.
>
> In previous projects I inserted iframes in GWT HTML-widgets and it worked 
> fine.
> How can I display this javascript-widget above in an GWT HTML-Widget?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.


Re: How-to display a Javascript-Widget (e.g. from tripadvisor) in an GWT HTML Widget?

2013-09-22 Thread Thomas Broyer


On Saturday, September 21, 2013 1:34:27 PM UTC+2, marian lux wrote:
>
> I found something about "Script Injection" and tried the following code to 
> add the script in my HTML page (on EntryPoint - method):
>
> Document doc = Document.get();
> ScriptElement script = doc.createScriptElement();
> script.setSrc("
> http://www.jscache.com/wejs?wtype=cdswritereviewlg&uniq=303&locationId=206597&lang=en_AU&border=true
> ");
> script.setType("text/javascript");
> script.setLang("javascript");
> doc.getBody().appendChild(script);
>

It's a bit easier with GWT's ScriptInjector (just don't forget 
setWindow(TOP_WINDOW)).

and added the other code as String in an HTML-Widget.
> But there is the same issue. Only the text: 
> "Review Grand Hotel 
> Wien
> "
> appears!
>

That script uses document.write() so it cannot be script-inserted. Try 
injecting the script it document.write()s though, it looks like it should 
be OK (just wouldn't benefit from "jscache.com", whatever it is)

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.


Re: How-to display a Javascript-Widget (e.g. from tripadvisor) in an GWT HTML Widget?

2013-09-22 Thread marian lux
Thank you for your answer, but

if I enter the URL 
http://www.jscache.com/wejs?wtype=cdswritereviewlg&uniq=303&locationId=206597&lang=en_AU&border=truein
 browser I see the following document.write():

document.write( 'http://www.tripadvisor.com/WidgetEmbed-cdswritereviewlg?amp;uniq=303&border=true&lang=en_AU&locationId=206597";>'
 );


The domain www.jscache.com is from Tripadvisor (
http://www.domainmetrics.de/domain/www.jscache.com) - maybe security reason 
- I don't know but it seems mandatory?

If I interpret your answer in a correct manner, I tested both:
ScriptInjector.fromUrl("http://www.jscache.com/wejs?wtype=cdswritereviewlg&uniq=303&locationId=206597&lang=en_AU&border=true";).setWindow(ScriptInjector.TOP_WINDOW).inject();
and
ScriptInjector.fromUrl("
http://www.tripadvisor.com/WidgetEmbed-cdswritereviewlg?amp;uniq=303&border=true&lang=en_AU&locationId=206597
").setWindow(ScriptInjector.TOP_WINDOW).inject();
but it is not working and only the text appears as described above.

If I try to enter the document.write()s script (http://www.tripadvisor.com.au/WidgetEmbed-cdswritereviewlg?uniq=303&locationId=206597&border=true&lang=en_AU";>)
 
in the online-editor: 
http://www.w3schools.com/html/tryit.asp?filename=tryhtml_intro it is also 
now not working and I also see only the text.
So it seems, that the document.write() is mandatory.
How can I solve this problem or do you know a better way to integrate a 
Tripadisor widgets for reviews of hotels, created with this site: 
http://www.tripadvisor.de/Widgets ?


Am Sonntag, 22. September 2013 16:03:08 UTC+2 schrieb Thomas Broyer:
>
>
>
> On Saturday, September 21, 2013 1:34:27 PM UTC+2, marian lux wrote:
>>
>> I found something about "Script Injection" and tried the following code 
>> to add the script in my HTML page (on EntryPoint - method):
>>
>> Document doc = Document.get();
>> ScriptElement script = doc.createScriptElement();
>> script.setSrc("
>> http://www.jscache.com/wejs?wtype=cdswritereviewlg&uniq=303&locationId=206597&lang=en_AU&border=true
>> ");
>> script.setType("text/javascript");
>> script.setLang("javascript");
>> doc.getBody().appendChild(script);
>>
>
> It's a bit easier with GWT's ScriptInjector (just don't forget 
> setWindow(TOP_WINDOW)).
>
> and added the other code as String in an HTML-Widget.
>> But there is the same issue. Only the text: 
>> "Review Grand Hotel 
>> Wien
>> "
>> appears!
>>
>
> That script uses document.write() so it cannot be script-inserted. Try 
> injecting the script it document.write()s though, it looks like it should 
> be OK (just wouldn't benefit from "jscache.com", whatever it is)
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.