OpenF2 / F2

Redefining web integration for the financial services community
Apache License 2.0
130 stars 62 forks source link

Change F2 script loading to be relative to manifest url, not html page url #73

Open ilinkuo opened 11 years ago

ilinkuo commented 11 years ago

Not urgent.

Currently, F2's script loading simply writes the manifest's scripts array into script tags in the html page without alteration. When relative urls are specified in the manifest, they are resolved relative to the target page. This is incorrect because the app provider controls the manifest and scripts whereas the container provider controls the target page. If the same manifest is to be used across different organizations/containers, the urls must be resolved relative to something the app provider controls , not something the container provider controls -- though a lot of current F2 implementations work because the app provider == container provider.

This can be resolved by publishing only full urls in the manifest, but this is not the preferred solution. The better solution is for the F2 loader to add logic to resolve relative urls relative to the manifest. The best solution would be to switch the underlying loader to AMD, as AMD's loader has this kind of logic.

This may cause some backward compatibility problems with existing implementations, but these are easily correctible.

timburcham commented 8 years ago

As this has been referenced in #270 , wondering if there's a solution to this issue that doesn't involve moving to AMD. @ilinkuo 's ideas on resolving relative urls relative to the manifest get part of the way there -- however, any requests inside the resulting appclass.js also need awareness of their own domain (for example, a script making an ajax request -- which broadens the original scope of this issue).

Unless someone is aware of something in javascript that allows for this detection, it would seem that the only way to make this additional use case work is to forward the base url on the app manifest request as an explicit parameter.