javascript - Eventhandler Safari -
i want generate html file javascript processes eventhandling in safari. following code works safari in static html file.
this code fine, need have more! creating html file javascript followed, name of javascript file c.js:
function createwindowsec(){ wsec = window.open("security.html","tester","width=400,height=400,left=10,top=10,scrollbars=no,toolbar=no,menubar=yes,location=yes,status=no"); wsec.document.open(); wsec.document.write('<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"><html><head><meta http-equiv="content-type" content="text/html;charset=utf-8"><title>bernhard</title><script type="text/javascript">function unloading(e) { return "hello here!"; } function load() {this.addeventlistener("beforeunload", unloading, false);}</script></head><body onload="load()"><p>i here</p></body></html>'); wsec.document.close(); return true; } function unloading(e) { return "der per mail zugeschickte sicherheitscode wird hiermit ungültig, mögliche Änderungen werden nicht gespeichert!"; } window.addeventlistener('beforeunload', unloading, false);
and calling html:
<html><head> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <title>test page</title> <style type="text/css"> body { font-family: sans-serif; } </style> <script language="javascript" type="text/javascript" src="c.js"> </script> </head> <body><a onclick="createwindowsec()">click here create html dynamically</a> <a href="javascript:window.opener;window.close();">close</a> </body></html>
the moment click on "click here create html dynamically" new window opened, eventhandling not working in safari. can tell me why, please?
greetings
bert
Comments
Post a Comment