On 2013-09-30 12:39, Yuri wrote:
Il 30/09/2013 11:39, Nathan Van Gheem ha scritto:
Yes, plone 5 will have many data attributes set on the body tag that
js developers will be able to use, context url being one of them.

why not a www.mysite.com/my_object/givemeallIneed/json which returns a
json file with all the needed data, without polluting the html?

-1

Its another request, its difficult to create a caching rule for it and its increases overall complexity. Also data-attributes are perfect for providing data to js.





On Mon, Sep 30, 2013 at 2:19 AM, Luca Fabbri
<[email protected]
<mailto:[email protected]>> wrote:

    On Sat, Sep 28, 2013 at 1:18 PM, Mikko Ohtamaa
    <[email protected]

<mailto:mikko%[email protected]>>
wrote:
    > Hi Andreas,
    >
    > This might just work:
    >
    > var contextURL = $("base").attr("href") // Magical <base> tag
    >

    Yes, I use the same trick, but Andreas is right. We still have only
    "portal_url" (global!) var. Maybe it's time to give some other vars
    (in a structure that use a namespace, to not pollute the global
    object).




    > Also here is my snippet to inject some custom variables for
    JavaScript using
    > a viewlet:
    >
    >

https://github.com/miohtama/collective.cartman/blob/master/collective/cartman/viewlets.py#L23

    >
    > Cheers,
    > Miguel
    >
    >
    > On 28 September 2013 11:27, Andreas Jung
<[email protected]
    <mailto:[email protected]>> wrote:
    >>
    >> -----BEGIN PGP SIGNED MESSAGE-----
    >> Hash: SHA1
    >>
    >> Hi there,
    >>
    >> it is 2013, we have Plone 4.3.2 and it still seems to be
impossible
    >> getting hold of the URL of the current context object in
    Javascript?
    >> The variable is still not available from
    plone_javascript_variables.js.
    >> What is the recommended way for gettting the context URL in JS?
    >>
    >> - -aj

--
Klein & Partner KG, member of BlueDynamics Alliance

_______________________________________________
Product-Developers mailing list
[email protected]
https://lists.plone.org/mailman/listinfo/plone-product-developers

Reply via email to