Re: HTML widget sometimes doesn't render 3rd party Javascript widget

2011-05-28 Thread Qiang Ma
Thanks Paul. Go to the Frame is not the best option. For example, if the 3rd
party javascript has popup window, it will be clipped within the Frame size.
So I am still struggling with just using HTML widget.

I found that it could all be the java script not loading when the HTML
widget is rendered. I am guessing that because I experimented add the java
script reference to the GWT base HTML and have the HTML widget only with the
"div id". On Firefox, the first load of the APP failed to display the
widget, but after a refresh(perhaps the javascript is cached), it will
display it correctly. on IE, it doesn't work.

So my current hope is : if I can find a way to dynamically load the
javascript in the code:



HTML html = new HTML("");
somepanel.add(html);
"magic load the above javascript"

Can someone tell me whether I am heading the right direction or even know
the little magic?
Thanks a lot!


On Sat, May 28, 2011 at 6:53 AM, Paul Stockley  wrote:

> You can hide the border on IE with a JSNI call.
>
> private native void hideIFrameBorder(Element iframeEl) /*-{
> iframeEl['frameBorder'] = '0';
> }-*/;
>
> private native void reloadIFrame(Element iframeEl) /*-{
> iframeEl.contentWindow.location.reload(true);
> }-*/;
>
> I also added a reload frame option as I couldn't find a way to reliably
> refresh a frame.
>
> --
> 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
> google-web-toolkit+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>

-- 
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 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: HTML widget sometimes doesn't render 3rd party Javascript widget

2011-05-28 Thread Paul Stockley
You can hide the border on IE with a JSNI call.

private native void hideIFrameBorder(Element iframeEl) /*-{
iframeEl['frameBorder'] = '0';
}-*/; 

private native void reloadIFrame(Element iframeEl) /*-{
iframeEl.contentWindow.location.reload(true);
}-*/;

I also added a reload frame option as I couldn't find a way to reliably 
refresh a frame.

-- 
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 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: HTML widget sometimes doesn't render 3rd party Javascript widget

2011-05-28 Thread Qiang Ma
I tried to use a Frame widget to include a html page just with the following
banner and it shows up on all browsers. But it doesn't look nice, e.g. it
has an extra border on IE.

Just wondering why HTML widget can't show the banner correctly, as simple as
following:
HTML html = new HTML("");
somePanel.add(html);

Any advice here?

On Thu, May 26, 2011 at 10:50 AM, maq  wrote:

> Gabriel,
>
> Thanks for reply. Apologize for not being clear about my problem.
> I was not trying to calling any javascripts through JSNI.
> I simply want to include the banner scripts got from Expedia affiliate
> search form in a GWT HTML widget.
>
> 

Re: HTML widget sometimes doesn't render 3rd party Javascript widget

2011-05-26 Thread maq
Gabriel,

Thanks for reply. Apologize for not being clear about my problem.
I was not trying to calling any javascripts through JSNI.
I simply want to include the banner scripts got from Expedia affiliate
search form in a GWT HTML widget.



So I created HTML object with the above content and lay it out along
with other GWT widgets. But it shows up only in a Firefox on SUSE. On
windows, neither firefox and IE displays it. (I guess it may be
dependent on the browser.)

Similar problem happens to include the widget script using GWT HTML
from addthis.com

- maq



-- 
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 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: HTML widget sometimes doesn't render 3rd party Javascript widget

2011-05-26 Thread Gabriel
Hi,

First, when you want to access variables and functions from JSNI that
are outside of the GWT code you must use the $wnd. prefix, for example
to run the JavaScript alert() function from JSNI you would write
$wnd.alert('something');
Second, you may be trying to call external JavaScript functions or
access DOM elements before the external script or DOM were fully
loaded. In such a case wrapping the call to the JSNI method with a
ScheduledCommand or a Timer may help. Try these:
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
   public void execute() {
  // call JSNI method here
   }
}
or
new Timer() {
   public void run() {
  // call JSNI method here
   }
}.schedule(100); // play with the number of milliseconds
I recommend trying the ScheduledCommand first - when you use it in
scheduleDeferred(), it will be called after all other browser
operations have been finished. In my experience you should check early
if whatever solution that works in development mode also works in
compiled mode, you may get different behavior sometimes, for example
you would need to use a different period of time before you can call
external JavaScript.

On May 26, 2:21 pm, maq  wrote:
> Hi,
>
> I tried to use GWT HTML widget to include a third party widget such
> as  javascript code for Expedia banner. It doesn't seem always working
> when I test it. If the same javascript is directly put in the static
> HTML host page, it always works.
>
> Has anyone seen similar problem?
>
> - maq

-- 
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 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



HTML widget sometimes doesn't render 3rd party Javascript widget

2011-05-26 Thread maq
Hi,

I tried to use GWT HTML widget to include a third party widget such
as  javascript code for Expedia banner. It doesn't seem always working
when I test it. If the same javascript is directly put in the static
HTML host page, it always works.

Has anyone seen similar problem?

- maq

-- 
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 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.