mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-03 14:59:18 +02:00
Fixed for firefox
This commit is contained in:
parent
1fdbf609f5
commit
951d6ff3e2
5 changed files with 29 additions and 11 deletions
|
@ -47,11 +47,19 @@ EPUBJS.Section.prototype.load = function(_request){
|
|||
EPUBJS.Section.prototype.replacements = function(_document){
|
||||
var task = new RSVP.defer();
|
||||
var base = _document.createElement("base"); // TODO: check if exists
|
||||
|
||||
var head;
|
||||
base.setAttribute("href", this.url);
|
||||
_document.head.insertBefore(base, _document.head.firstChild);
|
||||
|
||||
if(_document) {
|
||||
head = _document.querySelector("head");
|
||||
}
|
||||
if(head) {
|
||||
head.insertBefore(base, head.firstChild);
|
||||
task.resolve();
|
||||
} else {
|
||||
task.reject(new Error("No head to insert into"));
|
||||
}
|
||||
|
||||
task.resolve();
|
||||
|
||||
return task.promise;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue