You need to be logged in to post in the forum - Log In
An active JCE Pro Subscription is required to post in the forum - Buy a Subscription
- Support
- Forum
- JCE Editor
- URL absolute/relative and protocol
Support is currently Online
Official support hours:
Monday To Friday
From 09:00 To 17:00 Europe/London (BST)
From 09:00 To 17:00 Europe/London (BST)
I have two questions with regard to URLs.
(1) Is there any way to have the absolute url be protocol neutral, that is not insert http: or https: and just //url...
We are getting links to images that are mixed depending on where they are inserted with the editor. Example, we may get a link to an image that is http:// but when it is viewed, it may be when the page is loaded with https...thus we get mixed content errors and images are blocked. Editors/Authors that don't have HTML knowledge are using the Image insertion and it defaults with the protocol prepended based on how they are accessing the site.
(2) In using plugins in Joomla! for the link URL, if we have absolute URLs enabled, the editor forces the http:// (or https://) in front of the {TAG} ... so when the tag is converted, the site root is forced in front of it. Is there a way to ignore conversion for tags someplace?
What would be nice is if the Editor had a checkbox for the insert link and insert image functions that would allow a novice user to check if they wanted the link they are inserting to be converted to absolute URL or left unchanged.
I tried writing custom javascript for the tinymce.init using different selectors, but can't get it to work... like
tinymce.init({
selector: '#absolute',
relative_urls: false
});
...and then telling the user when they need absolute links, to include "absolute" in the css ID of the link dialogue but that doesn't seem to work...probably not placing the javascript in the right location to execute on both front and back ends ???
Thanks
(1) Is there any way to have the absolute url be protocol neutral, that is not insert http: or https: and just //url...
We are getting links to images that are mixed depending on where they are inserted with the editor. Example, we may get a link to an image that is http:// but when it is viewed, it may be when the page is loaded with https...thus we get mixed content errors and images are blocked. Editors/Authors that don't have HTML knowledge are using the Image insertion and it defaults with the protocol prepended based on how they are accessing the site.
(2) In using plugins in Joomla! for the link URL, if we have absolute URLs enabled, the editor forces the http:// (or https://) in front of the {TAG} ... so when the tag is converted, the site root is forced in front of it. Is there a way to ignore conversion for tags someplace?
What would be nice is if the Editor had a checkbox for the insert link and insert image functions that would allow a novice user to check if they wanted the link they are inserting to be converted to absolute URL or left unchanged.
I tried writing custom javascript for the tinymce.init using different selectors, but can't get it to work... like
tinymce.init({
selector: '#absolute',
relative_urls: false
});
...and then telling the user when they need absolute links, to include "absolute" in the css ID of the link dialogue but that doesn't seem to work...probably not placing the javascript in the right location to execute on both front and back ends ???
Thanks
Sorry, a slight error, fixed here - https://jsfiddle.net/k38y9f82/1/
Just because you're not paranoid doesn't mean everybody isn't out to get you.
(1) Is there any way to have the absolute url be protocol neutral, that is not insert http: or https: and just //url...
We are getting links to images that are mixed depending on where they are inserted with the editor. Example, we may get a link to an image that is http:// but when it is viewed, it may be when the page is loaded with https...thus we get mixed content errors and images are blocked. Editors/Authors that don't have HTML knowledge are using the Image insertion and it defaults with the protocol prepended based on how they are accessing the site.
The simplest solution here is to set Relative URLs to Yes in Editor Profiles -> Editor Parameters -> Cleanup & Output.
(2) In using plugins in Joomla! for the link URL, if we have absolute URLs enabled, the editor forces the http:// (or https://) in front of the {TAG} ... so when the tag is converted, the site root is forced in front of it. Is there a way to ignore conversion for tags someplace?
JCE doesn't process the {TAG} syntax (this is done by the associated plugin in the front-end), so it is regarded as plain text. Any URL within this tag is regarded as a normal link URL.
Just because you're not paranoid doesn't mean everybody isn't out to get you.
Yeah, we need absolute URLs, we just need to remove the protocol. I was hoping there was a configuration option to make the default link include the // so the editor wouldn't try to translate it.
The {TAG} is being translated correctly by the respective plugin, but the editor is inserting the path in front of it when it renders.
Its a mess, I know. With content being syndicated, included in newsletters, facebook posts, etc. and other 3rd party extensions having their own mailing functions, it would be nice if the Email function of Joomla could be set to convert paths to absolute when content goes out. That seems to be our biggest problem.
Was hoping for a neat under-the-hood trick that would give us the ability to turn on/off the conversion on the fly.
The {TAG} is being translated correctly by the respective plugin, but the editor is inserting the path in front of it when it renders.
Its a mess, I know. With content being syndicated, included in newsletters, facebook posts, etc. and other 3rd party extensions having their own mailing functions, it would be nice if the Email function of Joomla could be set to convert paths to absolute when content goes out. That seems to be our biggest problem.
Was hoping for a neat under-the-hood trick that would give us the ability to turn on/off the conversion on the fly.
Here is some javascript you can try - https://jsfiddle.net/k38y9f82/
Just because you're not paranoid doesn't mean everybody isn't out to get you.
Sorry, a slight error, fixed here - https://jsfiddle.net/k38y9f82/1/
Just because you're not paranoid doesn't mean everybody isn't out to get you.
Ryan, I added this to the callback that you provided me with...
I added this just after the test !url ... this addition prevents JCE (tiny) from converting any URL that contains a Joomla {tag}.
Thanks to your help I now understand the callback routine better and where to put it. This means I can use an ID or class selector in javascript to dynamically ignore certain html code from being translated.
Can you offer any recommendations of what NOT to do in this routine? Other than keeping it simple and not messing with things too much.
Thank you!!
// Don't replace {tags} with absolute/relative urls
//
var tag = /\{.*\}/;
if (tag.test(url)) {
return url;
}
I added this just after the test !url ... this addition prevents JCE (tiny) from converting any URL that contains a Joomla {tag}.
Thanks to your help I now understand the callback routine better and where to put it. This means I can use an ID or class selector in javascript to dynamically ignore certain html code from being translated.
Can you offer any recommendations of what NOT to do in this routine? Other than keeping it simple and not messing with things too much.
Thank you!!
Other than keeping it simple and not messing with things too much.
That's always a good idea.
You might simplify your addition. A url is unlikely to contain a { so if it does it's probably be a tag, so:
if (/\{/.test(url)) {
return url;
}
Just because you're not paranoid doesn't mean everybody isn't out to get you.
- Page :
- 1
There are no replies made for this post yet.
Be one of the first to reply to this post!
Be one of the first to reply to this post!