How to redirect HTML inside a dialogbox

72 views
Skip to first unread message

Oscar

unread,
Jun 29, 2011, 12:05:29 PM6/29/11
to Google Web Toolkit
Hi all,

I'm new at GWT and I'm trying to create a dialogbox that shows a
website from an external URL. I would also like that when the user
clicks a link, the content generated appears inside the same
dialogbox.

Right now when the user clicks on a link it redirects to a whole new
page as the user clicks to an HTML link.

I would like to do this without having to have access to the HTML code
from the server side.

Is it possible?

jhulford

unread,
Jun 30, 2011, 9:55:16 AM6/30/11
to Google Web Toolkit
I think you may be able to put an iframe (gwt Frame) inside a
DialogBox and have that work, I haven't done this myself but in theory
I think it should work.

Oscar

unread,
Jun 30, 2011, 5:28:34 PM6/30/11
to google-we...@googlegroups.com
Hi jhulford,

Thanks for your answer!

What you say works great for most pages although when the page wants to open a new window this is opened in a new window/tab in the browser. Is there a way to capture these events and avoid opening a new page?

jhulford

unread,
Jul 1, 2011, 8:55:55 PM7/1/11
to Google Web Toolkit
You should be able to add a click handler to the anchor and call
preventDefault() on the ClickEvent passed to it to prevent the default
page opening action of the anchor tag.

Oscar

unread,
Jul 4, 2011, 9:50:37 PM7/4/11
to google-we...@googlegroups.com
Hi again!

Thanks for your reply.

If I am understanding it right, I should use the anchor for the links contained inside the iframe, right?

The thing is that I don't have access to the embedded content. I want to show an external website inside the iframe but I don't want it to send users away from my site.

Is it possible?

jhulford

unread,
Jul 6, 2011, 11:45:48 AM7/6/11
to Google Web Toolkit
I think you're on a bit of a fools errand here and doing something
that's going to greatly annoy the users of your site - especially now
that tabbed browsing is ubiquitous. I'd definitely not use your site
if you broke links to external pages like that for me.

Oscar

unread,
Jul 6, 2011, 12:16:54 PM7/6/11
to google-we...@googlegroups.com
Hi jhulford,

Thanks again for your time,

I agree that the embedded site should be able to open a new tab/window. What I don't want is the iframe to have access to the parent.

I guess that what I'm trying to do is something like a sandboxed iframe. Nonetheless, when I try to use sandboxed iframe with Firefox (5.0) it just ignores the sandbox  attribute.

Would there be a way to make it work?
Reply all
Reply to author
Forward
0 new messages