mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Refuse to work at all on browsers that do not support <iframe srcdoc>
This commit is contained in:
parent
97e337784d
commit
133a073ef7
@ -125,6 +125,12 @@ def do_update_interface_data():
|
||||
|
||||
|
||||
def main():
|
||||
if document.createElement('iframe').srcdoc is undefined:
|
||||
document.body.innerHTML = '<p style="margin:1.5em; max-width: 40em">' + _(
|
||||
'You are using a browser that does not have the iframe srcdoc attribute.'
|
||||
' This is not supported. Use a better browser such as <b>Google Chrome</b> or <b>Mozilla'
|
||||
' Firefox</b>, instead.')
|
||||
return
|
||||
interface_data = get_interface_data()
|
||||
if interface_data.is_default or not interface_data.library_map:
|
||||
load_interface_data()
|
||||
|
@ -231,7 +231,9 @@ def sandboxed_html(html, style, sandbox):
|
||||
html = html or ''
|
||||
css = 'html, body { margin: 0; padding: 0; font-family: __FONT__ } p:first-child { margin-top: 0; padding-top: 0; -webkit-margin-before: 0 }'.replace('__FONT__', get_font_family())
|
||||
css += style or ''
|
||||
ans.srcdoc = f'<html><head><style>{css}</style></head><body>{html}</body></html>'
|
||||
final_html = f'<!DOCTYPE html><html><head><style>{css}</style></head><body>{html}</body></html>'
|
||||
# Microsoft Edge does not support srcdoc not does it work using a data URI.
|
||||
ans.srcdoc = final_html
|
||||
return ans
|
||||
|
||||
if __name__ is '__main__':
|
||||
|
Loading…
x
Reference in New Issue
Block a user