Skip to content

FIX: WebView not showing in gallery app#3843

Merged
vakrilov merged 1 commit intomasterfrom
web-view
Mar 21, 2017
Merged

FIX: WebView not showing in gallery app#3843
vakrilov merged 1 commit intomasterfrom
web-view

Conversation

@vakrilov
Copy link
Copy Markdown
Contributor

Using url will throw exception now.

@SvetoslavTsenov
Copy link
Copy Markdown
Contributor

👍

@vakrilov vakrilov merged commit 8e6b510 into master Mar 21, 2017
@vakrilov vakrilov deleted the web-view branch March 21, 2017 14:59
@EddyVerbruggen
Copy link
Copy Markdown
Contributor

Nooooooooooooo! I need that property. There is no other way to load a local html file with a querystring; passing ~/file.html to src works, but ~/file.html?foo=bar loads a blank page because it can't find the local file. url works perfectly for that case.

@vakrilov
Copy link
Copy Markdown
Contributor Author

@EddyVerbruggen We should be able to make this work with src property as well.
Do you have specific html doc that we can test with?
Also is this android/ios (or both) related issue?

@EddyVerbruggen
Copy link
Copy Markdown
Contributor

@vakrilov That would be awesome!

Theoretically (looking at the code, which is in the common file of the module) it's for both platforms, but I only verified this on iOS.

What I'm doing now is loading a map with natively determined lat/lng (to suppress a very nasty web-geolocation prompt on iOS):

webView.url = `file:///${fs.knownFolders.currentApp().path}/mypath/map.html?lat=${location.lat}&lng=${location.lng}`;

With the src attribute that would be:

webView.src = `~/mypath/map.html?lat=${location.lat}&lng=${location.lng}`;

The local HTML file queries the url and extracts the lat/lng params. But it could be anything of course. You can just do:

webView.src = '~/mypath/myfile.html?foo=bar';

Currently it won't find myfile.html at all because of the query params, but if you can make that work again you can alert the URL in myfile.html - if that still contains ?foo=bar then we can use src instead of url.

<!DOCTYPE html>
<html>
  <script type="text/javascript" charset="utf-8">
    alert("URL: " + document.location.href);
  </script>
</html>

@the-reality-engineer
Copy link
Copy Markdown
Contributor

the-reality-engineer commented Apr 5, 2017

IMO, I think we should keep both properties:

src should be the url that was explicitly set on the webview (and triggers a load)
url should be only a getter that always provides the current url (automatically updated on redirects, navigation, etc)

@lock
Copy link
Copy Markdown

lock bot commented Aug 27, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Aug 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants