Opening new window

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Opening new window

Tambet Matiisen
Hi everybody!

I'm struggling with popup-blockers. Consider this simple form:

<html xmlns="http://www.w3.org/1999/xhtml"
   xmlns:xforms="http://www.w3.org/2002/xforms"
   xmlns:events="http://www.w3.org/2001/xml-events">
<head>
<title>Load test!</title>
<xforms:model>
<xforms:instance xmlns="">
<data>
<url>http://www.eesti.ee/</url>
</data>
</xforms:instance>
</xforms:model>
</head>
<body>
<h1>Load test</h1>
<xforms:trigger>
<xforms:label>Load!</xforms:label>
<xforms:load ref="url" show="new" events:event="DOMActivate"/>
</xforms:trigger>
</body>
</html>

What happens when you press Load! button:
* Firefox opens new window as desired.
* IE displays popup warning, opens new window after you enable popups.
* Chrome doesn't do anything. After you enable popups in options it also
opens new window.

Is there a way to open new window without warning in every browser? I
understand, that this is unfortunate side-behavior of AJAX-based
architecture of Orbeon - browsers generally allow one popup per one
click, but somehow this connection between click and window.open() gets
lost, because window.open() is done as a result of AJAX call.

Now, after having written this e-mail it finally struck me - AVT-s help
me out again:

<a href="{url}" target="_blank">Link</a>

Tested, works. So this e-mail becomes sharing e-mail, instead of asking
help :).

   Tambet


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Opening new window

Alessandro  Vernet
Administrator
Tambet,

Yes, exactly: in most cases, using a link with an AVT is the way to go.

If you want users to download a file, and that you can store the link
to the file (URL) or base64 of the file in an instance, then you can
save yourself some work using a <xforms:output ref="file"
appearance="xxforms:download">, which will generate a link for you and
take care of serving the file you specified. You can see an example
here:

https://github.com/orbeon/orbeon-forms/blob/master/src/resources/apps/xforms-sandbox/samples/output-download.xhtml

In other cases generating a link with AVT isn't convenient, as you
need information about what is currently in the form to generate the
link. This is what happens in Form Builder when you click on the Test
button. In that case we used an iframe to display the new page, and
POST to an iframe, even if triggered from JavaScript isn't restricted.
That solution works well for Form Builder, as you want a preview of
your form, and it makes sense to see it in something that looks like a
dialog, but obviously this wouldn't work in all cases.

Alex

On Thu, Jan 20, 2011 at 7:32 AM, Tambet Matiisen
<[hidden email]> wrote:

> Hi everybody!
>
> I'm struggling with popup-blockers. Consider this simple form:
>
> <html xmlns="http://www.w3.org/1999/xhtml"
>  xmlns:xforms="http://www.w3.org/2002/xforms"
>  xmlns:events="http://www.w3.org/2001/xml-events">
> <head>
> <title>Load test!</title>
> <xforms:model>
> <xforms:instance xmlns="">
> <data>
> <url>http://www.eesti.ee/</url>
> </data>
> </xforms:instance>
> </xforms:model>
> </head>
> <body>
> <h1>Load test</h1>
> <xforms:trigger>
> <xforms:label>Load!</xforms:label>
> <xforms:load ref="url" show="new" events:event="DOMActivate"/>
> </xforms:trigger>
> </body>
> </html>
>
> What happens when you press Load! button:
> * Firefox opens new window as desired.
> * IE displays popup warning, opens new window after you enable popups.
> * Chrome doesn't do anything. After you enable popups in options it also
> opens new window.
>
> Is there a way to open new window without warning in every browser? I
> understand, that this is unfortunate side-behavior of AJAX-based
> architecture of Orbeon - browsers generally allow one popup per one click,
> but somehow this connection between click and window.open() gets lost,
> because window.open() is done as a result of AJAX call.
>
> Now, after having written this e-mail it finally struck me - AVT-s help me
> out again:
>
> <a href="{url}" target="_blank">Link</a>
>
> Tested, works. So this e-mail becomes sharing e-mail, instead of asking help
> :).
>
>  Tambet
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing
> list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
Orbeon Forms - Web forms, open-source, for the Enterprise -
http://www.orbeon.com/
My Twitter: http://twitter.com/avernet


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet