how to get truly relative links?

Last post 04-14-2010, 7:05 AM by densam. 3 replies.
Sort Posts: Previous Next
  •  04-01-2010, 6:53 PM 59818

    how to get truly relative links?

    If I use relative URLs and a baseHref, the full baseHref should be stripped out of links. For example if I set:
     
    editor.BaseHref = http://www.mysite.com/myfolder/
     
    Then I expect my relative image and link paths to have all that stripped out...that is, to be converted from
     
    http://www.mysite.com/myfolder/image.jpg
     
    to
     
    image.jpg
     
    Which would be a true relative link. Instead, I get
     
    /mysitefolder/image.jpg
     
    Which is not relative to my baseHref, but to the site's root folder. Which is obviously why you call this "SiteRelative" rather than "Relative". (Which makes me wonder what the point is of the BaseHref variable since you're disregarding it.)
     
    While "SiteRelative" is s probably the best in most situations, it doesn't work for environments where CuteEditor is used under a domain and directory structure that differs from where the HTML it outputs will be used. Example:
     
    CuteEditor is used here:
    mysite.com/myfolder/admin/editor.asp
     
    Output code is used here:
    mysubdomain.mysite.com
     
    which points to 
    mysite.com/myfolder/
     
    See the issue? All the links that CuteEditor outputs will have /myfolder/ in them, even though there is no such folder on the subdomain.
     
    I suggest that besides "SiteRelative", you add a "Relative" option that  will create links that are truly relative to the baseHref.
  •  04-06-2010, 4:13 PM 59906 in reply to 59818

    Re: how to get truly relative links?

    Please check this example:
     
     
    editor.BaseHref = "http://mydomain.com"
     
    If you insert an image, it will create HTML code like:
     
    Type here <img border="0" alt="" src="http://cutesoft.net/uploads/10n2.jpg" width="135" height="85" />
     
    The real path of this image is http://mydomain.com/uploads/10n2.jpg.
     
    Hope it helps.

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  04-09-2010, 11:33 PM 59980 in reply to 59906

    Re: how to get truly relative links?

    Interesting...thanks for trying to clarify, Adam. Unfortunately, the example you sent doesn't seem to work, so I'm still not quite clear on how this works. So does basehref only work correctly in conjunction with the absolute URLs setting? Or does it force SiteRelative URLs to become absolute if set?
     
    Either way, its not at all clear from the documentation:
    http://cutesoft.net/asp/document/index.htm#page=CuteEditor.Editor.BaseHref.html
     
    I assumed this worked like the <base href> tag does in HTML, which is implicitly prepended to all relative URLs. Rather, this setting seems to modify all relative URLs, automatically and explicitly prepending this BaseHref URLs to them, transforming them into absolute URLs. Which is fine, I suppose, as long as that's clear to users.
  •  04-14-2010, 7:05 AM 60084 in reply to 59818

    Re: how to get truly relative links?

    THANKS FOR THE EFFORT BY BLOGGING

    Hot! Internet Agency - We Help You Sell With Professional SEO
    ad agency | advertising agency
View as RSS news feed in XML