Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Discussions > OpenSocial and Gadgets Specification Discussion > Spec proposal - JS/CSS relative path support
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  21 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Michael Mahemoff  
View profile  
 More options Apr 23 2008, 6:01 am
From: "Michael Mahemoff" <mich...@mahemoff.com>
Date: Wed, 23 Apr 2008 11:01:27 +0100
Local: Wed, Apr 23 2008 6:01 am
Subject: Spec proposal - JS/CSS relative path support

I posted this as a question in the API group and it was suggested I make a
spec proposal.

The proposal is to allow gadget authors to include Javascript or CSS using a
relative path against the URL of the XML gadget spec. Right now, you have to
use  standard script/link tags, which means you must use absolute paths in
the case of content-type=HTML gadgets (relative paths don't work  of course
because the gadget is served from the gadget server, not from the source).
Absolute paths means you have to hard-code your domain and path information,
which makes it unsuitable for running in different environments
(dev/test/production/etc) and distributing gadgets to others.

AFAIK the only way to achieve it right now is to manually calculate the
gadget URL and dynamically include the script/stylesheet, but this approach
is slow and unreliable. I'm looking for a way to include "../common.js" and
have the gadget server output a standard <script> tag from it when it
generates the gadget content.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Arne Roomann-Kurrik  
View profile  
 More options Apr 23 2008, 2:17 pm
From: "Arne Roomann-Kurrik" <kur...@google.com>
Date: Wed, 23 Apr 2008 11:17:02 -0700
Local: Wed, Apr 23 2008 2:17 pm
Subject: Re: Spec proposal - JS/CSS relative path support

+1 this would really make serving gadgets out of SVN (and having release/dev
tagged versions) much easier.

~Arne

On Wed, Apr 23, 2008 at 3:01 AM, Michael Mahemoff <mich...@mahemoff.com>
wrote:

--
OpenSocial IRC - irc://irc.freenode.net/opensocial

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Zhen Wang  
View profile  
 More options Apr 23 2008, 3:20 pm
From: "Zhen Wang" <wa...@google.com>
Date: Wed, 23 Apr 2008 12:20:13 -0700
Local: Wed, Apr 23 2008 3:20 pm
Subject: Re: Spec proposal - JS/CSS relative path support
+1


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kevin Brown  
View profile  
 More options Apr 23 2008, 5:21 pm
From: "Kevin Brown" <e...@google.com>
Date: Wed, 23 Apr 2008 14:21:15 -0700
Local: Wed, Apr 23 2008 5:21 pm
Subject: Re: Spec proposal - JS/CSS relative path support

I'm completely in favor of this idea, but we need a solid implementation
proposal. It's not clear to me whether or not simply setting a base url in
the html output will be sufficient. Rewriting urls could become very error
prone.

On Wed, Apr 23, 2008 at 3:01 AM, Michael Mahemoff <mich...@mahemoff.com>
wrote:

--
~Kevin

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Zhen Wang  
View profile  
 More options Apr 23 2008, 6:27 pm
From: "Zhen Wang" <wa...@google.com>
Date: Wed, 23 Apr 2008 15:27:13 -0700
Local: Wed, Apr 23 2008 6:27 pm
Subject: Re: Spec proposal - JS/CSS relative path support
I suggest we inject a <base> tag automatically, or, better yet, allow
gadget developers to control the content of the <head> section.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kevin Brown  
View profile  
 More options Apr 23 2008, 7:19 pm
From: "Kevin Brown" <e...@google.com>
Date: Wed, 23 Apr 2008 16:19:47 -0700
Local: Wed, Apr 23 2008 7:19 pm
Subject: Re: Spec proposal - JS/CSS relative path support

On Wed, Apr 23, 2008 at 3:27 PM, Zhen Wang <wa...@google.com> wrote:

> I suggest we inject a <base> tag automatically, or, better yet, allow
> gadget developers to control the content of the <head> section.

Setting <base> would be an obvious potential solution, but I don't know that
it's clear that this adequately solves the problem without creating new
ones.

--
~Kevin

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Arne Roomann-Kurrik  
View profile  
 More options Apr 23 2008, 9:06 pm
From: "Arne Roomann-Kurrik" <kur...@google.com>
Date: Wed, 23 Apr 2008 18:06:03 -0700
Local: Wed, Apr 23 2008 9:06 pm
Subject: Re: Spec proposal - JS/CSS relative path support

I believe that someone previously brought up the idea of adding a
substitution token like __BASE_URL__ that would be rewritten with the base
URL of the gadget.  This way, authors would have a bit more control compared
to automatic rewriting.  I can't remember if there were any inherent
problems with this approach, though... is this still a possibility?

~Arne

--
OpenSocial IRC - irc://irc.freenode.net/opensocial

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Zhen Wang  
View profile  
 More options Apr 23 2008, 9:23 pm
From: "Zhen Wang" <wa...@google.com>
Date: Wed, 23 Apr 2008 18:23:02 -0700
Local: Wed, Apr 23 2008 9:23 pm
Subject: Re: Spec proposal - JS/CSS relative path support
I am not aware of any security issues with the <base> tag.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Mahemoff  
View profile  
 More options Apr 24 2008, 1:18 am
From: "Michael Mahemoff" <mich...@mahemoff.com>
Date: Thu, 24 Apr 2008 06:18:58 +0100
Local: Thurs, Apr 24 2008 1:18 am
Subject: Re: Spec proposal - JS/CSS relative path support

On Wed, Apr 23, 2008 at 10:21 PM, Kevin Brown <e...@google.com> wrote:
> I'm completely in favor of this idea, but we need a solid implementation proposal. It's not clear to me whether or not simply setting a base url in the html output will be sufficient. Rewriting urls could become very error prone.

I personally don't have any strong preferences on the precise
mechanism. As long as others are willing to propose concrete details,
I will stay out of that debate.

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kevin Brown  
View profile  
 More options Apr 24 2008, 1:55 am
From: "Kevin Brown" <e...@google.com>
Date: Wed, 23 Apr 2008 22:55:52 -0700
Local: Thurs, Apr 24 2008 1:55 am
Subject: Re: Spec proposal - JS/CSS relative path support

On Wed, Apr 23, 2008 at 6:06 PM, Arne Roomann-Kurrik <kur...@google.com>
wrote:

> I believe that someone previously brought up the idea of adding a
> substitution token like __BASE_URL__ that would be rewritten with the base
> URL of the gadget.  This way, authors would have a bit more control compared
> to automatic rewriting.  I can't remember if there were any inherent
> problems with this approach, though... is this still a possibility?

Certainly a possibility, but it's awfully ugly and hacky. I'm definitely in
favor of setting a base element, so long as it actually works :).


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Evan Gilbert  
View profile  
 More options Apr 24 2008, 2:26 am
From: Evan Gilbert <uid...@google.com>
Date: Wed, 23 Apr 2008 23:26:56 -0700
Local: Thurs, Apr 24 2008 2:26 am
Subject: Re: Spec proposal - JS/CSS relative path support

<base> may cause more headaches when we inline, and I could also see it
causing problems with the social XHR requests (which may use a relative URL
back to the server).

I like the equivalent of a substitution token... we could also have a
<Require> feature for loading JS/CSS, this might make it easier to identify
and concatenate resources for optimized processing.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kevin Brown  
View profile  
 More options Apr 24 2008, 2:36 am
From: "Kevin Brown" <e...@google.com>
Date: Wed, 23 Apr 2008 23:36:35 -0700
Local: Thurs, Apr 24 2008 2:36 am
Subject: Re: Spec proposal - JS/CSS relative path support

On Wed, Apr 23, 2008 at 11:26 PM, Evan Gilbert <uid...@google.com> wrote:
> <base> may cause more headaches when we inline, and I could also see it
> causing problems with the social XHR requests (which may use a relative URL
> back to the server).

Inlined gadgets would always have their urls rewritten regardless of whether
a base url was specified or not. Everything has to be forced through the
cajoling proxy to ensure that it is safe (even images), so this isn't really
an issue. Caja already allows for this type of behavior since it uses
callbacks for url rewriting.

Social XHR requests can simply use an absolute url on the same domain as the
renderer, so that's not really an issue either.

Zhen has been doing some research at my request to try to determine any
situations where <base> doesn't work for the iframe case, and so far we
haven't turned up any, so it probably is a viable solution to this problem,
and it's certainly a lot cleaner than dropping substitutions all over your
gadget.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Mahemoff  
View profile  
 More options Apr 24 2008, 5:07 am
From: "Michael Mahemoff" <mich...@mahemoff.com>
Date: Thu, 24 Apr 2008 10:07:09 +0100
Local: Thurs, Apr 24 2008 5:07 am
Subject: Re: Spec proposal - JS/CSS relative path support
For maximum flexibility, it would be good if the script had a way to
discover the source path, e.g. with a token. For instance, I mentioned
CSS and JS, but it may also be that the script needs to refer to
something else, e.g. a media item or a CGI service. Or it may want to
generate a link based on the path.

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Cassie  
View profile  
 More options Apr 24 2008, 11:28 am
From: Cassie <d...@google.com>
Date: Thu, 24 Apr 2008 17:28:33 +0200
Local: Thurs, Apr 24 2008 11:28 am
Subject: Re: Spec proposal - JS/CSS relative path support

btw - this would be for the next spec iteration, which we refer to as 0.9 I
suppose.

On Thu, Apr 24, 2008 at 11:07 AM, Michael Mahemoff <mich...@mahemoff.com>
wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Arne Roomann-Kurrik  
View profile  
 More options Apr 24 2008, 3:59 pm
From: "Arne Roomann-Kurrik" <kur...@google.com>
Date: Thu, 24 Apr 2008 12:59:53 -0700
Local: Thurs, Apr 24 2008 3:59 pm
Subject: Re: Spec proposal - JS/CSS relative path support

It's a shame that we can't tag threads as 0.8, 0.9, etc.  Are you collecting
proposals for 0.9 anywhere?  It seems far enough out that early proposals
like this could get lost along the way...

--
OpenSocial IRC - irc://irc.freenode.net/opensocial

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
fargo  
View profile  
 More options May 14 2008, 6:08 pm
From: fargo <johnfa...@gmail.com>
Date: Wed, 14 May 2008 15:08:08 -0700 (PDT)
Local: Wed, May 14 2008 6:08 pm
Subject: Re: Spec proposal - JS/CSS relative path support
Thus far <base> does seem like the obvious solution.

Concretely, the proposal is:
"When rendering a gadget in an IFRAME which has URL [gadgetUrl],
inject <base>[gadgetUrl]</base> in the <head> section of output."

For completeness, does anybody know if:
A) all major browsers support <BASE> URL resolution for...
B) every common usage of relative URLs, including: <a>, <img>,
<script>, <object>, CSS selectors, XHR, etc...
?

I suspect the answer is yes, but haven't been able to find a
comprehensive description of same. Zhen, what tests have you run? The
HTML spec (http://www.w3.org/TR/REC-html40/struct/links.html#h-12.4)
doesn't explicitly list every type of resolved relative reference.

In addition, this proposal should be augmented to ensure that
gadgets.io.makeRequest (all types) and <Preload> also honor the base
URL.

--John

On Apr 24, 12:59 pm, "Arne Roomann-Kurrik" <kur...@google.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mike Samuel  
View profile  
 More options May 14 2008, 7:59 pm
From: "Mike Samuel" <mikesam...@gmail.com>
Date: Wed, 14 May 2008 16:59:01 -0700
Local: Wed, May 14 2008 7:59 pm
Subject: Re: Spec proposal - JS/CSS relative path support

2008/5/14 fargo <johnfa...@gmail.com>:

> Thus far <base> does seem like the obvious solution.

> Concretely, the proposal is:
> "When rendering a gadget in an IFRAME which has URL [gadgetUrl],
> inject <base>[gadgetUrl]</base> in the <head> section of output."

> For completeness, does anybody know if:
> A) all major browsers support <BASE> URL resolution for...

BASE is part of HTML4 and HTML5.  http://www.w3.org/html/wg/html5/#the-base
XHTML strict only supports the href form, not the target form :
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Hjelmstad  
View profile  
 More options May 14 2008, 8:08 pm
From: John Hjelmstad <fa...@google.com>
Date: Wed, 14 May 2008 17:08:47 -0700
Local: Wed, May 14 2008 8:08 pm
Subject: Re: Spec proposal - JS/CSS relative path support

True. I just wanted to ensure that all the browsers we care about accurately
*support* HTML4 and 5. :)

Re: target form, we don't care so we're covered.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mike Samuel  
View profile  
 More options May 14 2008, 8:28 pm
From: "Mike Samuel" <mikesam...@gmail.com>
Date: Wed, 14 May 2008 17:28:12 -0700
Local: Wed, May 14 2008 8:28 pm
Subject: Re: Spec proposal - JS/CSS relative path support

2008/5/14 John Hjelmstad <fa...@google.com>:

> True. I just wanted to ensure that all the browsers we care about
> accurately *support* HTML4 and 5. :)

> Re: target form, we don't care so we're covered.

HTML 5 is a codification of existing browser behavior.  Mousing over the
link in
    <html><head><base href="http://foo.com/" /></head><body><a
href="bar">bar</a></body></html>
shows http://foo.com/bar in all the browsers I tested:  IE6, Firefox 2, and
Safari.

It's not deprecated in either XHTML or HTML5, so it can probably be relied
upon to continue working.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Zhen Wang  
View profile  
 More options May 14 2008, 8:54 pm
From: "Zhen Wang" <wa...@google.com>
Date: Wed, 14 May 2008 17:54:19 -0700
Local: Wed, May 14 2008 8:54 pm
Subject: Re: Spec proposal - JS/CSS relative path support
XHR is also covered in IE6, FF2, and Safari3.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kevin Brown  
View profile  
 More options May 14 2008, 11:25 pm
From: "Kevin Brown" <e...@google.com>
Date: Wed, 14 May 2008 20:25:23 -0700
Local: Wed, May 14 2008 11:25 pm
Subject: Re: Spec proposal - JS/CSS relative path support

Based on this, it sounds like it's worth trying to implement it this way and
see if it works. I'll start the ball rolling in Shindig to see if there are
any cases that don't work; we also need to make sure it all can be
implemented in conjunction with the static content rewriting that Louis has
proposed.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google