navigator

Mocha + React: navigator is not defined

江枫思渺然 提交于 2019-12-08 02:09:57
问题 I'm trying to write the first test for React components and keep getting error: ReferenceError: navigator is not defined I have component and one of it's children use codemirror for displaying editable textareas. The thing is that in codemirror there is a check for type of navigator. And since I run this code not in browser, but in terminal with node.js it's not defined. Some folks on SO advised to set global variable, but it didn't work for me. Here is code of the test: global.navigator = {

How to set 'react-native-drawer' visible only to Dashboard after login in react-native

余生颓废 提交于 2019-12-07 23:50:57
问题 In react-native, I want to disable drawer on Login and enable drawer on Dashboard Screen. I have implemented 'react-native-drawer' with Navigator to navigate between routes. render method as follows: render() { <Drawer ref={(ref) => this._drawer = ref} disabled={!this.state.drawerEnabled} type="overlay" content={<Menu navigate={(route) => { this._navigator.push(navigationHelper(route)); this._drawer.close() }}/>} tapToClose={true} openDrawerOffset={0.2} panCloseMask={0.2} closedDrawerOffset={

navigator.geolocation.getCurrentPosition no longer working in Safari mobile after iOS9 update

只愿长相守 提交于 2019-12-07 23:14:45
问题 I have a web app that has this code for getting the user's coordinates: if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(function(position) { But the moment I updated to iOS9 it ceased to work. I'm not even getting the Safari prompt anymore asking permission to get my location. Anyone else having this issue after updating to iOS9 and was able to resolve it? 回答1: I've noticed this myself and i'm wondering if iOS 9 Webkit has started to prevent this working via HTTP as I

where is the RESOURCES folder in the new xCode4.2

半腔热情 提交于 2019-12-07 13:23:25
问题 I can't seem to find the Resources folder in the new xCode4.2 project navigator where do i put the image resources for my app icon in this new xCode4.2? Here is a screenshot: 回答1: It looks like many samples from Apple now use the Supporting Files folder instead. You can go ahead and create your own Resources folder, or go ahead and use Apple's Supporting Files folder. 来源: https://stackoverflow.com/questions/7507997/where-is-the-resources-folder-in-the-new-xcode4-2

detect change on navigator.online

本秂侑毒 提交于 2019-12-07 02:15:37
问题 How can I detect if the navigator changed your state to online/offline? something like: var oldState = navigator.onLine; window.navigator.onlinechange = function(evnt,newState) { alert('your changed from' + oldState + ' to' + newState + 'state'); } 回答1: Something like this (not every browser supports these events, currently only IE 8,9 and FF > 3 support these events): var el = document.body; if (el.addEventListener) { el.addEventListener("online", function () { alert("online");}, true); el

navigator.geolocation.getCurrentPosition no longer working in Safari mobile after iOS9 update

限于喜欢 提交于 2019-12-06 13:46:21
I have a web app that has this code for getting the user's coordinates: if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(function(position) { But the moment I updated to iOS9 it ceased to work. I'm not even getting the Safari prompt anymore asking permission to get my location. Anyone else having this issue after updating to iOS9 and was able to resolve it? I've noticed this myself and i'm wondering if iOS 9 Webkit has started to prevent this working via HTTP as I know Chrome will be preventing this shortly as it currently throws the following alert in the web console.

How to set 'react-native-drawer' visible only to Dashboard after login in react-native

血红的双手。 提交于 2019-12-06 04:59:58
In react-native, I want to disable drawer on Login and enable drawer on Dashboard Screen. I have implemented 'react-native-drawer' with Navigator to navigate between routes. render method as follows: render() { <Drawer ref={(ref) => this._drawer = ref} disabled={!this.state.drawerEnabled} type="overlay" content={<Menu navigate={(route) => { this._navigator.push(navigationHelper(route)); this._drawer.close() }}/>} tapToClose={true} openDrawerOffset={0.2} panCloseMask={0.2} closedDrawerOffset={-3} styles={{ drawer: {shadowColor: '#000000', shadowOpacity: 0.8, shadowRadius: 3}, main: {paddingLeft

How to detect browser country in client site?

送分小仙女□ 提交于 2019-12-06 00:16:11
问题 I found the following website can detect my country and currency even in the private mode http://www.innisfreeworld.com/ It records in cookie, How do it do that? Is that possible fulfill in client site ? navigator? 回答1: There are multiple options to determine the locale. In descending order of usefulness, these are: Look up the IP address , with an IP geolocation service like Maxmind GeoIP. This is the location the request is coming from, i.e. if an American vacations in Italy and uses a

detect change on navigator.online

扶醉桌前 提交于 2019-12-05 08:12:06
How can I detect if the navigator changed your state to online/offline? something like: var oldState = navigator.onLine; window.navigator.onlinechange = function(evnt,newState) { alert('your changed from' + oldState + ' to' + newState + 'state'); } Something like this (not every browser supports these events, currently only IE 8,9 and FF > 3 support these events): var el = document.body; if (el.addEventListener) { el.addEventListener("online", function () { alert("online");}, true); el.addEventListener("offline", function () { alert("offline");}, true); } else if (el.attachEvent) { el

why Does “navigator.userAgent” in javaScript returns the String “Mozilla” when tried in a google chrome borwser?

☆樱花仙子☆ 提交于 2019-12-03 12:04:26
问题 Im developing a javaScript code and I want to determine the version and brand of the client's browser, here's the piece of code I'm using to do so : var browserName ; function BrowserCheckin () { if(navigator.userAgent.indexOf("Mozilla") > 0 ) browserName = "Mozilla" ; if (navigator.userAgent.indexOf("MSIE") > 0 ) browserName = "InternetExplorer"; if (navigator.userAgent.indexOf("Chrome") > 0) browserName= "Google Chrome" ; if(navigator.userAgent.indexOf("Opera") > 0 ) browserName = "Opera" ;