I have the following javascript variable with HTML code in it:
var html_ticket = '<!doctype html>' +
'<html dir="ltr" lang="en" class="no-js">' +
'<head> ' +
' <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> ' +
' ...... ' +
'</body> ' +
'</html> ';
I would like to open that variables content as a HTML in a new window.
Is this possible or am i approaching it wrong?
Regards
You simply use a code like so
var newWindow = window.open();
var html_ticket = '<html>...</html>';
newWindow.document.write(html_ticket);
of course you can: take a look here:
Open a new tab with custom HTML instead of a URL
var newWindow = window.open();
var html_ticket = '<html>...</html>';
newWindow.document.write(html_ticket);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.