Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

[12:30:42 CDT(-0500)] <obbo> ha, i see my problem. on each ajax request it is loading my template which requests jquery so after clicking 20 times i get 20 jquery requests

[12:30:56 CDT(-0500)] <obbo> 20 requests for the jquery library

[12:31:03 CDT(-0500)] <EricDalquist> hah

[12:31:06 CDT(-0500)] <EricDalquist> yeah that would do it (smile)

[12:40:32 CDT(-0500)] <obbo> EricDalquist: so in my case the template was including jquery via google's cdn. would it work in web proxy if i included it off the filesystem instead? so it doesn't get included every time?

[12:41:21 CDT(-0500)] <EricDalquist> well every time the script is loaded on the page the browser will load it

[12:41:51 CDT(-0500)] <EricDalquist> so you need to load the jquery script once when the page loads initially

[12:41:59 CDT(-0500)] <EricDalquist> and then just use that same instance for the rest of the life of the page

[12:42:32 CDT(-0500)] <obbo> if i don't include it, is it possible for the proxied portlet to use uportal's jquery instead?

[12:42:37 CDT(-0500)] <EricDalquist> it is

[12:42:41 CDT(-0500)] <EricDalquist> but you can't be sure of the version

[12:42:55 CDT(-0500)] <EricDalquist> we don't worry about portlet compatibility for uportal's javascript

[12:43:09 CDT(-0500)] <obbo> ok, thanks. understandable

[12:43:11 CDT(-0500)] <EricDalquist> why do you need to reload the <script> tag every time?

[12:44:46 CDT(-0500)] <obbo> the portlet is proxying a webpage we already had written. the page used jquery and we just pointed web proxy portlet at it

[12:44:56 CDT(-0500)] <EricDalquist> ok

[12:45:04 CDT(-0500)] <EricDalquist> so when you interact with that page

[12:45:08 CDT(-0500)] <EricDalquist> does it reload the whole portal page

[12:45:13 CDT(-0500)] <EricDalquist> or just the content in the wpp portlet?

[12:45:24 CDT(-0500)] <obbo> just the content in wpp

[12:47:07 CDT(-0500)] <EricDalquist> ah

[12:47:18 CDT(-0500)] <EricDalquist> yeah that would be a problem then

[12:47:39 CDT(-0500)] <EricDalquist> you would need to unbind all of the stuff that the WPP content jquery

[12:47:41 CDT(-0500)] <EricDalquist> is doing

[12:47:44 CDT(-0500)] <EricDalquist> otherwise it will leak memory

[12:49:55 CDT(-0500)] <obbo> is there anything special i need to do to have the wpp content use uportal's jquery? i removed the request for google's jquery but now it just tells me $ is undefined, like it doesn't see uportal's jquery

[12:50:43 CDT(-0500)] <EricDalquist> so uPortal and all portlet's use jQuery in noconflict mode

[12:50:59 CDT(-0500)] <EricDalquist> https://wiki.jasig.org/display/PLT/JavaScript+Best+Practices

[12:51:08 CDT(-0500)] <EricDalquist> uPortal's jQuery instance lives at "up.jQuery"

[12:51:38 CDT(-0500)] <EricDalquist> what you should do is wrap javascript that needs a reference to jQuery with:

[12:51:42 CDT(-0500)] <EricDalquist> (function($) {

[12:51:46 CDT(-0500)] <EricDalquist> JSHERE

[12:51:54 CDT(-0500)] <EricDalquist> })(up.jQuery);

[12:52:03 CDT(-0500)] <EricDalquist> that makes the $ var available but only in the closure

[12:52:06 CDT(-0500)] <EricDalquist> instead of globally

[12:52:10 CDT(-0500)] <obbo> ah, ok. thanks

[12:52:10 CDT(-0500)] <EricDalquist> which could break other things on the page

[12:52:24 CDT(-0500)] <EricDalquist> note that WPP has the ability to do pre/post static htmlk

[12:52:27 CDT(-0500)] <EricDalquist> so you could add that

[12:52:38 CDT(-0500)] <EricDalquist> and pull in a specific version of jquery there

[12:52:50 CDT(-0500)] <EricDalquist> grab it into a no-conflict reference

[12:53:30 CDT(-0500)] <EricDalquist> then in the post html you could do that closure to make the $ available

[12:54:58 CDT(-0500)] <obbo> yeah, that sounds like a better idea. the js uses 1.7+ apis a lot. i'll look into that. thanks for all your help

[12:55:09 CDT(-0500)] <EricDalquist> yup

[12:55:14 CDT(-0500)] <EricDalquist> good luck (smile)