nativescript-community / ui-webview

Extended WebView which adds many options such as custom scheme handlers, JavaScript execution, URL capturing, and more.
Apache License 2.0
13 stars 7 forks source link

Handle links that open in a new window / frame #5

Closed cdroege closed 2 years ago

cdroege commented 2 years ago

Currently, ui-webview does not open any links that have target='_blank' set or that are opened via window.open(). This change is picked from the official Nativescript webview here: https://github.com/NativeScript/NativeScript/pull/9430

I could not test this change with my current project directly as I had some problems creating a new package via npm run build (due to some config problems regarding Typescript as a tsconfig file was missing and some other issues). But it worked when I directly patched the npm package (although I manually transformed this code to Javascript beforehand).

@farfromrefug If you think this PR is useful and if you think I should test this again, I can test this change directly. But for that, I would need a package. The easiest solution for me would be, if you could create a package from this PR? But I also can create a package by myself. Then I would need the steps needed to build a package. Sorry, if I overlooked something for building a package (and thank you for maintaining this package!)

farfromrefug commented 2 years ago

@cdroege thanks your PR looks correct. The issue you had was (i suppose) with the fact that repo uses submodules. Normally it should be handled through npm install script https://github.com/nativescript-community/ui-webview/blob/master/package.json#L41

I am confident with your PR so i ll merge it Thanks!