tidev / titanium-sdk

🚀 Native iOS and Android Apps with JavaScript
https://titaniumsdk.com/
Other
2.76k stars 1.21k forks source link

iOS WebViewConfiguration preferences has many undocumented features #14070

Closed Informate closed 5 months ago

Informate commented 5 months ago

I have searched and made sure there are no existing issues for the issue I am filing

URL

https://titaniumsdk.com/api/structs/webviewpreferencesobject.html

Description

The list of properties for WebView Preferences is highly incomplete. A full list of the preferences is present at: https://github.com/WebKit/webkit/blob/main/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm

Suggestion

Complete the list or at least add a link and some explanation to WKPreferences.mm where the list is complete. The functionality already works in titanium if set, as for example does {"webGLEnabled": false}, but are completely undocumented on titanium docs. Some of the interesting preferences includes (as found in other StackOverflow users issues): allowFileAccessFromFileURLs and allowUniversalAccessFromFileURLs that are XMLHttpRequest related features especially useful when working with local WebViews.

Link to list: https://github.com/WebKit/webkit/blob/main/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm

m1ga commented 5 months ago

Feel free to create a PR and edit: https://github.com/tidev/titanium-sdk/blob/master/apidoc/Titanium/UI/iOS/WebViewConfiguration.yml to add the link

Informate commented 5 months ago

I do not know what a PR is, it ask me to fork the entire project. If you can do it for me, I just added a line at the end of the description:

description: | Use the method to create and use as a parameter of . Using this you can determine how soon a webpage is rendered, how media playback is handled, the granularity of items that the user can select, and many other options. This property can only be set when creating the webview and will be ignored when set afterwards.

See the example section "Usage of WebViewConfiguration with WebView in iOS".

Information on additional available preferences can be derived from the original WebKit sources: [WKPreferences.mm](https://github.com/WebKit/webkit/blob/main/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm)
m1ga commented 5 months ago

a PR is a pull request. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request

You fork the project, clone it locally, make the changes, commit the changes and create a PR. The normal github/git way.

But yes, I can do it for you too

m1ga commented 5 months ago

PR with your link https://github.com/tidev/titanium-sdk/pull/14072

Informate commented 5 months ago

Thanks!

Informate commented 5 months ago

Thanks! I know you do not like generated code, but it can also extract the entries for iOS:

javaScriptEnabled, javaScriptCanOpenWindowsAutomatically, minimumFontSize, suppressesIncrementalRendering, backspaceKeyNavigationEnabled, tabFocusesLinks, privateBrowsingEnabled, javaScriptMarkupEnabled, hyperlinkAuditingEnabled, offlineWebApplicationCacheEnabled, plugInsEnabled, allowsAnimatedImages, allowsAnimatedImageLooping, loadsImagesAutomatically, autosaves, enablesWebViewDarkMode, mockScrollbarsEnabled, textAreasAreResizable, textTracksEnabled, loadsSiteIconsIgnoringImageLoadingPreference, javaScriptCanAccessClipboard, developerExtrasEnabled, applicationCacheEnabled, javaScriptRuntimeFlags, localStorageEnabled, universalAccessFromFileURLsAllowed, fileAccessFromFileURLsAllowed, fetchAPIKeepAliveEnabled, fetchAPIStreamDataEnabled, contentSecurityPolicyEnabled, contentSecurityPolicyFrameAncestorsEnabled, webGLEnabled, accelerated2DCanvasEnabled, subpixelCSSOMElementMetricsEnabled, mediaDataLoadsAutomatically, backForwardCacheEnabled, suppressesTestingJavaScriptAlerts, linkPrefetchEnabled, networkCacheEnabled, suppressesBackForwardNavigationGestures, canvasUsesAcceleratedDrawing, prefetchDNS, staticDateAndTime, onlineApplicationCacheQuota, privateClickMeasurementEnabled, mediaCaptureRequiresSecureConnection, highPerformanceCanvasRenderingEnabled, screenCaptureRequiresUserGesture, allowsMediaCaptureOnInsecureSites, videoCaptureRequiresSecureConnection, webAudioEnabled, experimentalContentSecurityPolicyEnabled, domTimersThrottlingEnabled, modernMediaControlsEnabled, pictureInPictureEnabled, incrementalRenderingSuppressed, acceleratedCompositingEnabled, scrollAnimatorEnabled, asynchronousPluginInitializationEnabled, asynchronousPluginInitializationEnabledForAllPlugins, asynchronousPluginInitializationEnabledForAppQuirks, pluginProcessesEnabled, plugInSnapshottingEnabled, mediaPlaybackRequiresUserGesture, allowsPictureInPictureMediaPlayback, allowsInlineMediaPlayback, tabFocusesLinksByDefault, mediaDataPreloadingEnabled, allowCrossOriginSubresourcesToAskForCredentials, cacheAPIKeepAliveEnabled, asyncFrameScrollEnabled, zoomsPageToFit, visibleWindowSnapshottedAtBoot, canvasIsAccelerated, mediaControlsScale, mediaPlaybackAllowsInline, audioPlaybackRequiresUserGesture, suppressesIncrementalRendering, downloadsUndecodedImageData, localFileContentSniffingEnabled, pagingEnabled, contentBlockersEnabled, allowsInlineMediaPlaybackInPictureInPicture, shouldRespectImageOrientation, experimentalFeatureEnabled