Cordova Slack Digest

Sun, 28 Feb 2021 08:34:27 GMT

User count: 4384

Join the conversation at slack.cordova.io

Channel #general (3 messages)


Sat, 27 Feb 2021 14:00:54 GMT

@sinan.demir says

Hello to everyone,

Thank you so much @norman137 for your answer (https://github.com/apache/cordova-ios/issues/1086|1086). I want to ask a few more questions.

We manage the user's session with http://asp.net|asp.net session object. Chrome, Safari and Android WebView add the http://ASP.NET|ASP.NET_SessionId value that comes with the set-cookie from the server to the header in every request. IOS WKWebView does not add http://ASP.NET|ASP.NET_SessionId value to header.

I mentioned it before. We compile and publish a single application. Users download our application and connect to the service address published on their server.

For this reason, the settings we will make in config.xml have not been a solution for us.

<preference name = "hostname" value = "localhost" />```
I looked for a solution to update the hostname at runtime. What would be the most logical solution in your opinion? (<https://github.com/GEDYSIntraWare/cordova-plugin-webview-switch|cordova-plugin-webview-switch>)
```WebviewSwitch.setHostname ('<http://myserver.com|myserver.com>')```
Thank you for your help.

Sat, 27 Feb 2021 21:42:47 GMT

@slackbot says

This message was deleted.

Sun, 28 Feb 2021 05:48:36 GMT

@simunovics says

I am making folium maps with popup windows using branca IFrame. I embed hyperlinks in popup windows to open new browser windows. I would like to use cordova to deploy the maps on ios. For that, I tried to use cordova.InAppBrowser.open with IFrame as:

html="""
<!DOCTYPE html>
&lt;body&gt;
  &lt;h1&gt;Popup&lt;/h1&gt;&lt;br&gt;
  &lt;p&gt;
     Something something 
     &lt;a href="#"  onclick="window.open = cordova.InAppBrowser.open; window.open('<https://www.mit.edu>', '_system','location=yes');"&gt;Open link&lt;/a&gt;
  &lt;/p&gt;
  &lt;script type="text/javascript" src="cordova.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="js/index.js"&gt;&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;"""

iframe = branca.element.IFrame(html=html, width=400, height=250)
popup = folium.Popup(iframe, parse_html=True)
folium.Marker(
    location=[46.216, -124.1280],
    popup=popup
).add_to(m)

m.save('index.html')```
However, whatever I do, and wherever I add `&lt;script&gt;` entries with `cordova.js` in `index.html`, I always get an error:
`Can't find variable: cordova`

Everything works ok when I use `folium.Html` to create hyperlinks
instead of `branca.element.IFrame`, but that works for me only for short/simple HTML objects. In that case, adding:
```  &lt;script type="text/javascript" src="cordova.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="js/index.js"&gt;&lt;/script&gt;```
in the header of `index.html` document, does the job. When using `folium.Html` there are no IFrames and that seems to be the key.

Any pointers will be highly appreciated.

Channel #cordova-ios (1 messages)


Sat, 27 Feb 2021 19:03:48 GMT

@simunovics says

I have a question on syntax of replacing window.open() with cordova.InAppBrowser.open() as described in <https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-inappbrowser/index.html> Being new to JS and Cordova, I thought the assignment would be as simple as putting in the html header:

&lt;script type="text/javascript" src="js/index.js"&gt;&lt;/script&gt;
&lt;script&gt;
  window.open = cordova.InAppBrowser.open;
&lt;/script&gt;```
But that does not work. I get desired behavior on ios for Link 2 but not Link 1
```&lt;button onclick="window.open('<https://www.google.com>', '_system')"&gt;Open Link 1&lt;/button&gt;
&lt;button onclick="cordova.InAppBrowser.open('<https://www.google.com>', '_system')"&gt;Open Link 2&lt;/button&gt;```
Any suggestions will be appreciated.
Just figured out that
`&lt;button onclick="window.open = cordova.InAppBrowser.open; window.open('<https://www.google.com>', '_system')"&gt;Open Link 1&lt;/button&gt;`
works out. Is this how it is supposed to be used?