Page 1 of 1

Relative Hyperlinks

PostPosted: Wed Mar 25, 2009 4:18 pm
by adamb78
Is there any trick for getting the editor to show relative hyperlinks? If you click on HTML view it has either been putting in the full URL (IE) or a weird URL starting at the root of the location of the WYMEditor js (like

We were using Tiny before on this same installation and didn't have this issue.

Re: Relative Hyperlinks

PostPosted: Thu Mar 26, 2009 6:43 pm
by eadevel

Re: Relative Hyperlinks

PostPosted: Sun Mar 29, 2009 1:23 am
by adamb78
I saw that thread, and the one it linked to. But I haven't seen a simple "this is what you do to get it work." I can't believe everyone is having this issue with no straightforward solution.

Can anyone offer that solution in a few straightforward steps?

Re: Relative Hyperlinks

PostPosted: Wed Apr 01, 2009 5:01 pm
by bally
using 0.5-b2

I've seen the other posts also. I'm adding links like:

Code: Select all
$.wymeditors(0).insert('<h6><a href="'+this.href+'" title="">'+$(this).text()+'</a></h6>');

The source URL is absolute (eg. but is added with ../../etc.

Can anyone at least explain where this behavior is happening? I've gone through the source and cannot figure out how/why these URLs get changed. From the fix mentioned, it appears that this is supposed to be a feature, not a bug. Can someone explain that, also? I'd be happy to try to patch this if, well, if I knew what to patch. But, also, I don't really understand why it happens in the first place.

FWIW, I cannot have these kinds of links as I'm using the editor to create a newsletter email. This makes the links quite useless.

Re: Relative Hyperlinks

PostPosted: Thu Apr 02, 2009 6:20 pm
by eadevel
I've tried to explain where's the issue:

Basically it's a IE thing and has to do with innerHTML function.
Try reading the link above and if you come up with a solution, please let us know!! :wink:

Re: Relative Hyperlinks

PostPosted: Sat Apr 04, 2009 3:46 pm
by adamb78
I'm not a developer, but I know that it works OK with Tiny. Maybe there is something in the way Tiny does things that can be copied into WYMEditor?

Re: Relative Hyperlinks

PostPosted: Fri May 08, 2009 5:20 pm
by adamb78
I got a comment on the jquery ticket:

They said:
"Here are some possible workarounds that may work in your situation: If you know you are creating an A or IMG element, create it and set its attributes explicitly rather than using an HTML string to do it. For reading, grab the elements with a selector and use .attr() to get the href or src attributes."

Does anyone know how to patch WYMEditor to do that?

Re: Relative Hyperlinks

PostPosted: Tue Jan 05, 2010 9:08 pm
by mr_lundis
WYMeditor already sets these attributes directly when the elements are created, it's when the html() method gets called things get messy. And unfortunately, I see no easy fix other than implementing a completely js-based html/dom-parser. I've played around a little bit with innerXhtml by Steven Tucker, and done some minor modifications to it. But I never got around to implement it, as it's still rather slow and a bit untested.

Jhon Resig has also done something similar, and his implementation is a lot faster. But it only goes one way. If anyone feels up to it then implementing a combination of the two could be a good solution. I know Jean-Fran├žois (the guy in charge of the 0.5 development) would appreciate it!

Cheers! ;)