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?





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
    >> -----BEGIN PGP SIGNATURE-----
    >> Version: GnuPG v1.4.11 (Darwin)
    >> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
    >>
    >> iQGUBAEBAgAGBQJSRpLyAAoJEADcfz7u4AZj8ucLv1ijqugOmVdiEE2YDjlJZQCd
    >> PpP2uCmunCtx3rZ6YjPyWuUzgWU27TDw4hDRQwHGSXVBUJbp2WN6QDg9Pgc36Z7F
    >> qvuI/YdMoVaC5xEIkLIVjn/9oL+l/6nT3KpZTj7HABrG9b7XIS6I+VDDYbVqOZlo
    >> L8ku/u0s75AZxyR2+CF8K5xYFBhnFz/NtLwPuu4aRmL1wvHODzfu4n4XVpD67tNN
    >> xKCIGhD5zw/ONOJ7aDs0WSlZAe5ekOgFV11AJ6C3ZKtYnyG5mXeyd7zn4oL4edtk
    >> /7fp9hyW6vVDPatPP1FyECjOHwwS3MXwMkvAsOXszKaKXbyLKmyhoEMNEKxyjcZ6
    >> rgoD11+iFgkn8+yAW1gcnpZN3FIhpev28TJyeLp49dH7CDxzo8HXuq7r57wGG5+a
    >> xJ0l4aGm3IZF/2ra9k0814tXR5V+cw3rJuHpRa0yyHeEzPnYbeJv5bwc5se88MS5
    >> XuUR/yoiLheZlUe1PWhC8VeT+FDuSgQ=
    >> =yJUu
    >> -----END PGP SIGNATURE-----
    >>
    >> _______________________________________________
    >> Product-Developers mailing list
    >> [email protected]
    <mailto:[email protected]>
    >> https://lists.plone.org/mailman/listinfo/plone-product-developers
    >>
    >
    >
    >
    > --
    > Mikko Ohtamaa
    > http://opensourcehacker.com
    > http://twitter.com/moo9000
    >
    > _______________________________________________
    > Product-Developers mailing list
    > [email protected]
    <mailto:[email protected]>
    > https://lists.plone.org/mailman/listinfo/plone-product-developers
    >



    --
    -- luca

    twitter: http://twitter.com/keul
    linkedin: http://linkedin.com/in/lucafbb
    blog: http://blog.keul.it/
    _______________________________________________
    Product-Developers mailing list
    [email protected]
    <mailto:[email protected]>
    https://lists.plone.org/mailman/listinfo/plone-product-developers




--
Nathan Van Gheem
Solutions Architect
Wildcard Corp


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

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

Reply via email to