Open A Div On The Page In A New Window While Maintaining The Ability To Update It Via Websockets
I am trying to have a section of the page (where i have notifications) open in a new window (new browser window) while maintaining the ability to get websocket updates so the notif
Solution 1:
Try
html
<textareaplaceholder="click `open popup`
to open and update"></textarea><br /><inputtype="button"value="open"><inputtype="button"value="close">
js
$(function () {
$("input[value=open]").focus().one("click", function () {
$("body").append("<br /><span class=update></span>");
var popup = window.open("", "popup", "width=200, height=100");
popup.document.write("popup ready");
$(".update").html("popup ready");
popup.focus();
$("textarea").on("change", function (e) {
popup.document.write($(this).val() + "<br />");
$(".update").html(function (i, o) {
return o + $(e.target).val() + "<br />";
});
$(this).val("");
return popup.focus();
}).change();
$("input[value=close]").on("click", function () {
popup.close();
return $("textarea").attr("placeholder", "popup closed");
});
return $("textarea").attr("placeholder", "popup ready to update");
});
});
Post a Comment for "Open A Div On The Page In A New Window While Maintaining The Ability To Update It Via Websockets"