In TinyMCE, if I specify a link with the domain name and the domain name happens to be what Drupal was installed on, TinyMCE thinks it will be clever by getting rid of the domain name and protocol.

So I enter my link to be say http://mydomain.com/test.htm and TinyMCE replaces this with /test.htm. If I change the domain to http://outsidedomain.com/anypage.htm, Tiny doesn't touch this.

My issue is that I use a bunch of aliases, so I don't know which will be used, and to get my link to work correctly, I need to use an absolute link.

Anybody know how I can keep TinyMCE from rewriting absolute links it thinks are local?

Comments

bkudria’s picture

Ha! I just asked this, over here. Check out the thread I linked to in my post, ufku's solution may work for you. (It didn't for me).

smithaa02’s picture

It's tricky stuff... My initial understanding was that you have to set the "relative_urls" = false and "remove_script_host" = false. However, I've done that everywhere I can find this setting and no luck :(.

smithaa02’s picture

You know I think I did it...

Open up /sites/all/modules/tinymce/tinymce/jscripts/tiny_mce/tiny_mce_src.js and comment out the 'remove domain' part. So for me this was on 5936 and was changed to:

/*if (tinyMCE.getParam('remove_script_host')) {
start = "";
portPart = "";

if (port !== '')
portPart = ":" + port;

start = prot + "//" + host + portPart + "/";

if (url.indexOf(start) == 0)
url = url.substring(start.length-1);
}*/

Hopefully this doesn't cause too many problems down the road... I hear IE adds in domains by default when it shouldn't and this is why remove_script_host was added to start with....

bkudria’s picture

Well, instead of commenting out that whole section, why not just invalidate the 'if' condition? I.E., set remove_script_host to false. and, don't you need to edit the compressed version, not _src.js?

I've tried this, with all possible combinations of relative_urls, convert_urls, and remove_script_host, and nothing works. I'm tearing out my hair, any help appreciated!

pyisoeyz’s picture

There's the answer in wiki

Too bored to click?

To disable converting url,

convert_urls : 0, // default 1

Just to disable correction of host url,

remove_script_host : 0, // default 1

well, it normally works if you just change in "tiny_mce_src.js" if not, then... what to worry?!
just go to "tiny_mce.js" and change the value from 0 to 1.

eh.. still not ok yet?
search this line

u = t.documentBaseURI.toAbsolute(u, s.remove_script_host);

and change to

u = t.documentBaseURI.toAbsolute(u,0);

Best luck!

--
Impossible is the word to be found in the dictionary of fools.