window-object

How to insert HTML/JS into window (of type “panel”) created by chrome.windows.create?

痴心易碎 提交于 2019-12-23 18:11:48
问题 I'm creating a window in a Chrome Extension using chrome.windows.create . It's of type panel , so it's not a regular browser window or tab, but a free-standing window floating above all others. Having created it, I now need to insert some HTML and JavaScript into it. So how is that done? There's a Window Object returned from create, but it has no useful hooks in it - just a few attributes. Nothing in the documentation suggests how to do that, and I don't see and DOM tree fo it anywhere. Any

Qt 4.6 Adding objects and sub-objects to QWebView window object (C++ & Javascript)

倾然丶 夕夏残阳落幕 提交于 2019-12-22 05:25:09
问题 I am working with Qt's QWebView, and have been finding lots of great uses for adding to the webkit window object. One thing I would like to do is nested objects... for instance: in Javascript I can... var api = new Object; api.os = new Object; api.os.foo = function(){} api.window = new Object(); api.window.bar = function(){} obviously in most cases this would be done through a more OO js-framework. This results in a tidy structure of: >>>api ---------------------------------------------------

Qt 4.6 Adding objects and sub-objects to QWebView window object (C++ & Javascript)

喜夏-厌秋 提交于 2019-12-22 05:25:08
问题 I am working with Qt's QWebView, and have been finding lots of great uses for adding to the webkit window object. One thing I would like to do is nested objects... for instance: in Javascript I can... var api = new Object; api.os = new Object; api.os.foo = function(){} api.window = new Object(); api.window.bar = function(){} obviously in most cases this would be done through a more OO js-framework. This results in a tidy structure of: >>>api ---------------------------------------------------

Using the variable “name” doesn't work with a JS object

自作多情 提交于 2019-12-10 18:53:14
问题 The behaviour can be seen in this little snippet (execute it as a global script): var name = {}; name.FirstName = 'Tom'; alert(name.FirstName); The alert yields undefined in Chrome but works in IE and Firefox. I also get a weird value when I do alert(name); 回答1: window.name has a special purpose, and is supposed to be a string. Chrome seems to explicitly cast it to a string, so var name = {}; actually ends up giving the global variable name (i.e. window.name ) a value of "[object Object]" .

Accessing the window from Angular expression

╄→гoц情女王★ 提交于 2019-12-10 14:59:10
问题 According to the developer guide I should be able to access the browser window from inside Angular expressions with $window . Unlike JavaScript, where names default to global window properties, Angular expressions have to use $window to refer to the global window object. For example, if you want to call alert(), which is defined on window, in an expression you must use $window.alert(). However I can't seem to access $window from expressions evaluated with $scope.$eval . Here are some outputs

window[name] equivalent to dynamically access const and let declarations

て烟熏妆下的殇ゞ 提交于 2019-12-08 05:13:31
问题 The old style JavaScript var declaration outside of a closure is global (top-level scope) and can be accessed in a browser from the window object. For example, the declaration var x = 3; can be accessed with window['x'] . How do you similarly access a const or let declaration given the name (string) of the declaration? var x = 3; const y = 7; let z = 21; console.log('x = ' + window['x']); //x = 3 console.log('y = ' + window['y']); //y = undefined console.log('z = ' + window['z']); //z =

window[name] equivalent to dynamically access const and let declarations

て烟熏妆下的殇ゞ 提交于 2019-12-06 16:00:59
The old style JavaScript var declaration outside of a closure is global (top-level scope) and can be accessed in a browser from the window object. For example, the declaration var x = 3; can be accessed with window['x'] . How do you similarly access a const or let declaration given the name (string) of the declaration? var x = 3; const y = 7; let z = 21; console.log('x = ' + window['x']); //x = 3 console.log('y = ' + window['y']); //y = undefined console.log('z = ' + window['z']); //z = undefined For the above example, how do you get the values 7 and 21 for "y" and "z" instead of undefined ?

Get all user defined window properties?

百般思念 提交于 2019-11-26 16:04:09
Is there a way to find out all user defined window properties and variables (global variables) in javascript? I tried console.log(window) but the list is endless. You would need to do the work for yourself. Read in all properties, on the first possible time you can. From that point on, you can compare the property list with your static one. var globalProps = [ ]; function readGlobalProps() { globalProps = Object.getOwnPropertyNames( window ); } function findNewEntries() { var currentPropList = Object.getOwnPropertyNames( window ); return currentPropList.filter( findDuplicate ); function

Get all user defined window properties?

做~自己de王妃 提交于 2019-11-26 04:41:26
问题 Is there a way to find out all user defined window properties and variables (global variables) in javascript? I tried console.log(window) but the list is endless. 回答1: You would need to do the work for yourself. Read in all properties, on the first possible time you can. From that point on, you can compare the property list with your static one. var globalProps = [ ]; function readGlobalProps() { globalProps = Object.getOwnPropertyNames( window ); } function findNewEntries() { var

window.location.href and window.open () methods in JavaScript

醉酒当歌 提交于 2019-11-25 23:39:22
问题 What is the difference between window.location.href and window.open () methods in JavaScript? 回答1: window.location.href is not a method, it's a property that will tell you the current URL location of the browser. Changing the value of the property will redirect the page. window.open() is a method that you can pass a URL to that you want to open in a new window. For example: window.location.href example: window.location.href = 'http://www.google.com'; //Will take you to Google. window.open()