Re: Problems adding a Digg This link

2008-12-04 Thread Ghostcoder

I have a similar problem ,I am trying to add twitter js to my GWT site
using HTMLPanel widget ,I am trying to add the divs and javascript to
the HTMLPanel.
It works on Firefox but not on IE or chrome.I think IE and chrome does
not take the script tag or it does not call the javascript (may be for
security reasons I don't know why ).Please suggest  a better way to do
this .I have pasted below the html content i am trying to add to
HTMLPanel

div id=twitter_div
h2 class=sidebar-titleTwitter Updates/h2
ul id=twitter_update_list/ul
/div
script type=text/javascript src=http://twitter.com/javascripts/
blogger.js/script
script type=text/javascript src=http://twitter.com/statuses/
user_timeline/xyz.json?callback=twitterCallback2amp;count=5/
script







On Nov 30, 5:05 am, mayop100 [EMAIL PROTECTED] wrote:
 Thanks for the prompt feedback guys. I played around with the HTML
 widget, but I wasn't able to get it to actually execute the script. I
 didn't want to just include it in my index.html file... I plan to have
 multiple diggthis links on the site, and each one will need to jump
 to the appropriate place using history tokens.

 I managed to get it working without running any javascript though. 
 Thediggscript just creates an iframe with some URL-encoded arguments, so
 I simply created my own iframe and encoded the URL myself. The only
 downside is that I'll have to watch out ifdiggever changes their
 API.

 If anyone does find a way to use the HTML widget to actually create
 and _execute_ javascript code I'd love to hear about it though.

 -Andrew

 On Nov 29, 9:48 am, Charlie Collins [EMAIL PROTECTED] wrote:

  Reinier is correct there, it's more complicated than I was making it.
  ThatDiggscript works quite a bit differently than I was guessing
  before I actually looked at it. What I meant is still possible, but
  probably not what you want depending on the situation. If your host
  page has a separate div for your GWT content, and a separate div for
  the littleDiggscript, what I originally said should work - but it
  would always justlink(digg) to your host page (which would be your
  entire GWT app in the canonical case).

  To do this right, it looks like you would need to make sure your GWT
  app uses History and then you need to Digg the correct state with
  the tokens and so on. You could use HTML as Reinier suggests, and make
  sure to change the URL for theDiggbutton each time you have
  different state:

  script type=text/javascript
  digg_url = 'WEBSITE_URL';
  /script
  script src=http://digg.com/tools/diggthis.js; type=text/
  javascript/script

  Looks like they also have a submit your own thing that you could
  just make a GET request to to 
  submit:http://digg.com/submit?url=example.comtitle=TITLEbodytext=DESCRIPTI

  (With that you could make your own buttons or links or whatever, and
  then just make thediggrequest with proper params. You could use that
  and make aDiggGWT Widget? Sorry I piped up though, I don't really
  know much aboutDiggin particular, I was just trying to make
  suggestions in the general GWT sense.)

  On Nov 29, 10:39 am, Reinier Zwitserloot [EMAIL PROTECTED] wrote:

   I doubtdigg'sjs thingie is written by an intelligent developer (digg
   has a track record of sorts). There IS a way to write such widget
   scripts so they work in all situations, including the peculiar way GWT
   builds webpages, but not many web widgets work this way. So, assuming
   for a moment that won't fly, here's the easiest alternative:

   Use com.google.gwt.user.ui.HTML.

   On Nov 29, 1:48 pm, Charlie Collins [EMAIL PROTECTED] wrote:

Can't you just add the script element to your host page, the same way
you would in HTML?  That is to say, don't try to recreate the script
element in Java and have GWT insert it, just put it on the host page
(the same place you put the gwt script tag, etc).

On Nov 27, 11:33 pm, mayop100 [EMAIL PROTECTED] wrote:

 I'm trying to add a DiggThislinkto my gwt website. If my website
 were just an html page, all I would need to do is include this line in
 my HTML:
 script src=http://digg.com/tools/diggthis.js; type=text/
 javascript/script

 I've tried adding a new element to the page with DOM.createElement
 (script), but it ends up replacing the entire contents of the page
 with mydigglink. I've also tried a JSNI solution, but with no
 success.

 It seems to me there should be an easy solution for this... anyone?

 Thanks -

 -Andrew
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Problems adding a Digg This link

2008-11-29 Thread Charlie Collins

Can't you just add the script element to your host page, the same way
you would in HTML?  That is to say, don't try to recreate the script
element in Java and have GWT insert it, just put it on the host page
(the same place you put the gwt script tag, etc).

On Nov 27, 11:33 pm, mayop100 [EMAIL PROTECTED] wrote:
 I'm trying to add a Digg This link to my gwt website. If my website
 were just an html page, all I would need to do is include this line in
 my HTML:
 script src=http://digg.com/tools/diggthis.js; type=text/
 javascript/script

 I've tried adding a new element to the page with DOM.createElement
 (script), but it ends up replacing the entire contents of the page
 with my digg link. I've also tried a JSNI solution, but with no
 success.

 It seems to me there should be an easy solution for this... anyone?

 Thanks -

 -Andrew
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Problems adding a Digg This link

2008-11-29 Thread Reinier Zwitserloot

I doubt digg's js thingie is written by an intelligent developer (digg
has a track record of sorts). There IS a way to write such widget
scripts so they work in all situations, including the peculiar way GWT
builds webpages, but not many web widgets work this way. So, assuming
for a moment that won't fly, here's the easiest alternative:

Use com.google.gwt.user.ui.HTML.


On Nov 29, 1:48 pm, Charlie Collins [EMAIL PROTECTED] wrote:
 Can't you just add the script element to your host page, the same way
 you would in HTML?  That is to say, don't try to recreate the script
 element in Java and have GWT insert it, just put it on the host page
 (the same place you put the gwt script tag, etc).

 On Nov 27, 11:33 pm, mayop100 [EMAIL PROTECTED] wrote:

  I'm trying to add a Digg This link to my gwt website. If my website
  were just an html page, all I would need to do is include this line in
  my HTML:
  script src=http://digg.com/tools/diggthis.js; type=text/
  javascript/script

  I've tried adding a new element to the page with DOM.createElement
  (script), but it ends up replacing the entire contents of the page
  with my digg link. I've also tried a JSNI solution, but with no
  success.

  It seems to me there should be an easy solution for this... anyone?

  Thanks -

  -Andrew
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Problems adding a Digg This link

2008-11-29 Thread Charlie Collins

Reinier is correct there, it's more complicated than I was making it.
That Digg script works quite a bit differently than I was guessing
before I actually looked at it. What I meant is still possible, but
probably not what you want depending on the situation. If your host
page has a separate div for your GWT content, and a separate div for
the little Digg script, what I originally said should work - but it
would always just link (digg) to your host page (which would be your
entire GWT app in the canonical case).

To do this right, it looks like you would need to make sure your GWT
app uses History and then you need to Digg the correct state with
the tokens and so on. You could use HTML as Reinier suggests, and make
sure to change the URL for the Digg button each time you have
different state:

script type=text/javascript
digg_url = 'WEBSITE_URL';
/script
script src=http://digg.com/tools/diggthis.js; type=text/
javascript/script

Looks like they also have a submit your own thing that you could
just make a GET request to to submit:
http://digg.com/submit?url=example.comtitle=TITLEbodytext=DESCRIPTIONmedia=MEDIAtopic=TOPIC.

(With that you could make your own buttons or links or whatever, and
then just make the digg request with proper params. You could use that
and make a Digg GWT Widget? Sorry I piped up though, I don't really
know much about Digg in particular, I was just trying to make
suggestions in the general GWT sense.)




On Nov 29, 10:39 am, Reinier Zwitserloot [EMAIL PROTECTED] wrote:
 I doubt digg's js thingie is written by an intelligent developer (digg
 has a track record of sorts). There IS a way to write such widget
 scripts so they work in all situations, including the peculiar way GWT
 builds webpages, but not many web widgets work this way. So, assuming
 for a moment that won't fly, here's the easiest alternative:

 Use com.google.gwt.user.ui.HTML.

 On Nov 29, 1:48 pm, Charlie Collins [EMAIL PROTECTED] wrote:

  Can't you just add the script element to your host page, the same way
  you would in HTML?  That is to say, don't try to recreate the script
  element in Java and have GWT insert it, just put it on the host page
  (the same place you put the gwt script tag, etc).

  On Nov 27, 11:33 pm, mayop100 [EMAIL PROTECTED] wrote:

   I'm trying to add a Digg This link to my gwt website. If my website
   were just an html page, all I would need to do is include this line in
   my HTML:
   script src=http://digg.com/tools/diggthis.js; type=text/
   javascript/script

   I've tried adding a new element to the page with DOM.createElement
   (script), but it ends up replacing the entire contents of the page
   with my digg link. I've also tried a JSNI solution, but with no
   success.

   It seems to me there should be an easy solution for this... anyone?

   Thanks -

   -Andrew
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Problems adding a Digg This link

2008-11-29 Thread mayop100

Thanks for the prompt feedback guys. I played around with the HTML
widget, but I wasn't able to get it to actually execute the script. I
didn't want to just include it in my index.html file... I plan to have
multiple digg this links on the site, and each one will need to jump
to the appropriate place using history tokens.

I managed to get it working without running any javascript though. The
digg script just creates an iframe with some URL-encoded arguments, so
I simply created my own iframe and encoded the URL myself. The only
downside is that I'll have to watch out if digg ever changes their
API.

If anyone does find a way to use the HTML widget to actually create
and _execute_ javascript code I'd love to hear about it though.

-Andrew

On Nov 29, 9:48 am, Charlie Collins [EMAIL PROTECTED] wrote:
 Reinier is correct there, it's more complicated than I was making it.
 That Digg script works quite a bit differently than I was guessing
 before I actually looked at it. What I meant is still possible, but
 probably not what you want depending on the situation. If your host
 page has a separate div for your GWT content, and a separate div for
 the little Digg script, what I originally said should work - but it
 would always just link (digg) to your host page (which would be your
 entire GWT app in the canonical case).

 To do this right, it looks like you would need to make sure your GWT
 app uses History and then you need to Digg the correct state with
 the tokens and so on. You could use HTML as Reinier suggests, and make
 sure to change the URL for the Digg button each time you have
 different state:

 script type=text/javascript
 digg_url = 'WEBSITE_URL';
 /script
 script src=http://digg.com/tools/diggthis.js; type=text/
 javascript/script

 Looks like they also have a submit your own thing that you could
 just make a GET request to to 
 submit:http://digg.com/submit?url=example.comtitle=TITLEbodytext=DESCRIPTI

 (With that you could make your own buttons or links or whatever, and
 then just make the digg request with proper params. You could use that
 and make a Digg GWT Widget? Sorry I piped up though, I don't really
 know much about Digg in particular, I was just trying to make
 suggestions in the general GWT sense.)

 On Nov 29, 10:39 am, Reinier Zwitserloot [EMAIL PROTECTED] wrote:

  I doubt digg's js thingie is written by an intelligent developer (digg
  has a track record of sorts). There IS a way to write such widget
  scripts so they work in all situations, including the peculiar way GWT
  builds webpages, but not many web widgets work this way. So, assuming
  for a moment that won't fly, here's the easiest alternative:

  Use com.google.gwt.user.ui.HTML.

  On Nov 29, 1:48 pm, Charlie Collins [EMAIL PROTECTED] wrote:

   Can't you just add the script element to your host page, the same way
   you would in HTML?  That is to say, don't try to recreate the script
   element in Java and have GWT insert it, just put it on the host page
   (the same place you put the gwt script tag, etc).

   On Nov 27, 11:33 pm, mayop100 [EMAIL PROTECTED] wrote:

I'm trying to add a Digg This link to my gwt website. If my website
were just an html page, all I would need to do is include this line in
my HTML:
script src=http://digg.com/tools/diggthis.js; type=text/
javascript/script

I've tried adding a new element to the page with DOM.createElement
(script), but it ends up replacing the entire contents of the page
with my digg link. I've also tried a JSNI solution, but with no
success.

It seems to me there should be an easy solution for this... anyone?

Thanks -

-Andrew
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Problems adding a Digg This link

2008-11-28 Thread mayop100

I'm trying to add a Digg This link to my gwt website. If my website
were just an html page, all I would need to do is include this line in
my HTML:
script src=http://digg.com/tools/diggthis.js; type=text/
javascript/script

I've tried adding a new element to the page with DOM.createElement
(script), but it ends up replacing the entire contents of the page
with my digg link. I've also tried a JSNI solution, but with no
success.

It seems to me there should be an easy solution for this... anyone?

Thanks -

-Andrew


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---