Opened 12 years ago
Closed 11 years ago
#10068 closed Bug (fixed)
Default implementation of getUrl fails with protocol relative URLs
Reported by: | Alex Lee | Owned by: | Piotr Jasiun |
---|---|---|---|
Priority: | Normal | Milestone: | CKEditor 4.3.2 |
Component: | General | Version: | 3.0 |
Keywords: | Cc: |
Description
CKEditor's default implementation of getUrl(), using a protocol relative URL in CKEDITOR_BASEPATH like
//assets.server.com/ckeditor/ckeditor.js
Returns a URL like
http://assets.server.com//assets.server.com/ckeditor/*
This can be worked around by setting a CKEDITOR_GETURL, but ideally CKEditor itself would be able to handle that.
Change History (9)
comment:1 Changed 12 years ago by
Status: | new → pending |
---|---|
Version: | 4.0.2 (GitHub - master) |
comment:2 Changed 12 years ago by
This error is in all cases that CKEDITOR.getUrl() is called. Most notably the language file that CKEditor grabs first is from the wrong resource URL.
This is not related to IE and can be reproduced in any browser.
Steps to reproduce:
- Set
window.CKEDITOR_BASEPATH="//localhost/ckeditor/";
(Wherever the path is, however the important thing is that it begins with//
instead ofhttp://
, which implieshttp:
if the current page is onhttp:
andhttps:
if the current page is onhttps:
.) - Load CKEditor with
<script src="//localhost/ckeditor/ckeditor.js"></script>
- See that CKEditor loader makes a request for
http://localhost//localhost/ckeditor/lang/en.js
For additional information on protocol-relative URLs, see http://paulirish.com/2010/the-protocol-relative-url/
comment:3 Changed 12 years ago by
Status: | pending → confirmed |
---|---|
Version: | → 3.0 |
@Aintaer thank you for the link.
Problem can be reproduced from CKEditor 3.0 in both CKE 3.x and 4.x (v4) branches
To reproduce:
- on page where you use editor set:
<script> window.CKEDITOR_BASEPATH="//localhost/ckeditor/4.0.1.1/ckeditor/" </script> <script src="//localhost/ckeditor/4.0.1.1/ckeditor/ckeditor.js"></script>
- Load page with editor
Result:
Base path gets concatenated with domain e.g. http://localhost//localhost/ckeditor...
To work around this problem instead of BASEPATH, set property GETURL:
<script> window.CKEDITOR_GETURL="//localhost/ckeditor/4.0.1.1/ckeditor/" </script> <script src="//localhost/ckeditor/4.0.1.1/ckeditor/ckeditor.js"></script>
comment:5 Changed 11 years ago by
Milestone: | → CKEditor 4.3.2 |
---|
Solution was proposed in https://github.com/ckeditor/ckeditor-releases/issues/8.
comment:6 Changed 11 years ago by
Owner: | set to Piotr Jasiun |
---|---|
Status: | confirmed → assigned |
comment:7 Changed 11 years ago by
Status: | assigned → review |
---|
There was no bug in getUrl
, because resource.indexOf( '/' ) !== 0
works pretty well with paths which has '' at the begginging. The problem was in basePath
which was created incorrectly for protocol-relative paths.
Changes in t/10068 and corresponding test branch.
comment:8 Changed 11 years ago by
Status: | review → review_passed |
---|
I rebased both branches and improved tests. They don't try to load CKEditor from non existing external domains, etc. All requests end with successfully. To achieve that I had to introduce CKTESTER.config.secondDomainName. All of us will have to create it, although usually tests pass without it too.
comment:9 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | review_passed → closed |
Fixed on master with git:50cadb239fd on dev and 80ed976c7 on tests.
Where do you get this error and in what situation? Does it by any chance happening with IE and images?
Could you describe test case steps to reproduce this error? 8022