javascript - Open a div on the page in a new window while maintaining the ability to update it via websockets -
javascript - Open a div on the page in a new window while maintaining the ability to update it via websockets -
i trying have section of page (where have notifications) open in new window (new browser window) while maintaining ability websocket updates notifications can received on both windows when gets updated.
i wondering if there anyway using jquery or other method. framework using backbone if matters.
thanks in advance ideas!
try
html
<textarea placeholder="click `open popup` open , update"></textarea> <br /> <input type="button" value="open"> <input type="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) { homecoming o + $(e.target).val() + "<br />"; }); $(this).val(""); homecoming popup.focus(); }).change(); $("input[value=close]").on("click", function () { popup.close(); homecoming $("textarea").attr("placeholder", "popup closed"); }); homecoming $("textarea").attr("placeholder", "popup ready update"); }); });
jsfiddle http://jsfiddle.net/guest271314/b2e7t/
javascript jquery backbone.js
Comments
Post a Comment