Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

SharePoint relative URL's

  Asked By: Stella    Date: Jul 13    Category: Sharepoint    Views: 3105

I have a page within SharePoint that includes several Content Fields which are based on the content type's site columns. The Content Fields are rich html and I'm pasting html into them. My problem comes in when the html contains an IMG tag which includes a SRC property. If I set the SRC property of the IMG tag to be a URL pointing to an image within SharePoint, specifically it resides on the same server as the site I am working on, then SharePoint treats the SRC URL as a relative URL. So when this Content Field is referenced in a page that is in a different website than the SharePoint web site, the link doesn't work and the image doesn't display. For example, I paste in SRC="http://site1:2000/images/button1.gif" as the SRC of the IMG tag into the html for the Content Field. When that content field is then referenced on another site, say site2, that image's SRC is rendered as SRC="http://site2/images/button1.gif" and the image doesn't display. If however the SRC of the image is set to another website, for example SRC="http://www.google.com/images/button1.gif" then SharePoint preserves the whole URL and the image's SRC is rendered as SRC="http://www.google.com/images/button1.gif" and everything works. Can you tell me how to preserve the whole URL when referencing a local resource within SharePoint?



2 Answers Found

Answer #1    Answered By: David Scott     Answered On: Jul 13

You could also check and update the url  if necessary in an event handler. I recently had a client that needed this done for the pesky content  editor web  part on a publishing site. I blogged my solution.


Answer #2    Answered By: Lakeshia Gould     Answered On: Jul 13

Another option would be using the Telerik RadEditor Lite which has the option to remove the absolute part of the URL built-in.

Didn't find what you were looking for? Find more on SharePoint relative URL's Or get search suggestion and latest updates.