Notalib / nativescript-webview-ext

Nativescript plugin with extended WebView functionality
Apache License 2.0
76 stars 37 forks source link

Some questions on the plug-in #65

Closed erjdriver closed 4 years ago

erjdriver commented 4 years ago

Some questions re the plugin - sorry I know of no other resource to contact you.

Thanks.

p.s. i'll close this on your reply.

m-abs commented 4 years ago

I'll answer your questions, but I need to make something clear.

I don't say this to be rude or anything, but we sometimes get a lot of issues that are more support than actual bug rapports.

Our NativeScripts plugins were developed for use in our own app and we don't in general offer support on them.

We will happily accept bug reports and PRs. In my spare time, I sometimes answer questions here or on the nativescript community slack, which is why answers can take a while.

Now to the answers :)

  • What's the difference between webview.src and webview.loadUrl().

  • src can be set in template.

  • loadUrl() returns a promise which resolves when loadFinished is triggered.

  • Is it possible to set a HTTP header REFERER value before loading a new url.

No, we don't support adding headers to the requests. We'd might accept a PR implementing it on both android and iOS (WkWebView).

  • Is there a way to check what the current url is loaded and also to force a page reload.

webview.src should be updated on page loads, but you could use JavaScript to get the current url from the webview.

webview.executeJavaScript('document.location.href').then((href) => console.log(href));

You could call webview.reload().

  • I tried loading an invalid url. In the loadFinishedEvent callback, the LoadFinishedEventData.error field was not set. How would know about error conditions.

That sounds like a bug, that should be fixed.

What platform and what OS version were you running it on?

erjdriver commented 4 years ago

Thanks for your response - I really appreciate it! Hopefully it'll help others also.

Re my reload() issue - the website actually redirected to another page - so a valid page was returned but not the one I asked for - so not a bug.

Re forcing reload webview.reload() doesn't seem to force a reload. I'll check that again tomorrow.

thanks again.