"Your browser doesn't support full screen" - WKWebview, macOS - swift

I am currently developing a cocoa web browser application like google chrome. I was testing it until I came across the problem that the wkwebview doesn't support full screen on videos. When I open a video, I get this message...
I thought I had to make the wkwebview a subview of the view, using this code
view.addSubview(webView)
I tried it and it still show the image above.
Can you please assist me on supporting full screen.

Open your project.
Right click on prject app grade folder from sidebar and click new file.
in choose a template click objective-C file.
name it for example WKPreferences and enter.
Now next window press create.
On next create Bridging-Header.
Now you can see two new files in your sidebar.
Paste following code in WKPreferences.m
#import <Foundation/Foundation.h>
Paste following code in Bridge-Bridging-Header.h
#import <WebKit/WebKit.h>
#interface WKPreferences ()
-(void)_setFullScreenEnabled:(BOOL)fullScreenEnabled;
#end
Now Paste following code in viewcontroller.swift
webView.configuration.preferences._setFullScreenEnabled(true)
Thats it.

You should be able to just put the following in the Swift-File where the WebView is created:
webView.configuration.preferences.setValue(true, forKey: "fullScreenEnabled")

Related

How do I make a button in Swift to execute a line of HTML code?

I am working on a small desktop app that will open websites on the click of a button. It's sort of a bookmark launcher in app form. I need to be able to connect a button in Swift to a single line of HTML code and have the button execute the code.
This is not an iOS app, it is macOS only. I am not looking to launch a UIWebView, I just need a single line of HTML executed.
Can anyone help? Thanks in advance.
I don't understand what you mean by "execute html code"
if you have a link and want to open it you can do:
NSWorkspace.shared.open(url:"your url")
https://developer.apple.com/documentation/appkit/nsworkspace

IOS/IPHONE Safari or Chrome viewing local files

I have created a stand-alone HTML, CSS, JavaScript offline map view using Leaflet (see leafletjs.com). I can use FileApp/DiskAid to download the application to the iphone. I can tap on the HTML file and view the app, but as you can see from the attached screen shot, the layers and zoom controls are at the top of the screen. If I try and press them then your HTML viewer with block the press and slide down a banner (BACK, ACTIONS, etc) (the black top banner that your viewer shows).
Better yet, I would like to open it with SAFARI since it has the NITRO JS engine, but the only OPEN IN options I get are Evernote, RiddleDocs, Mover, and DropBox.
Is there way to tell safari or chrome for IOS to open up a local file system where the html is: http:// 127.0.0.1/fileApp/Toby.html for example where Toby is my HTML file? I realize is somewhere it the data for t
First Step :-
These options are configured using keys in your Info.plist file. The first key is UIFileSharingEnabled, which enables iTunes sharing of files in your Documents folder. The second key is LSSupportsOpeningDocumentsInPlace, which grants the local file provider access to files in your Documents folder. Add these keys to your Info.plist and set their values to YES.
enter image description here
enter image description here
let documentPicker = UIDocumentPickerViewController(documentTypes: [String(kUTTypePDF)], in: .import)
documentPicker.delegate = self
documentPicker.modalPresentationStyle = .overCurrentContext
present(documentPicker, animated: true, completion: nil)
You can use option either to import or export files from app. Also you can define the type of files you want to export or import...

Opening a File Dialog Box when button is tapped in iphone

I did a cocoa application in which the file dialog box is opening when a button is tapped with the use of NSOpenPanel controller in cocoa applications.For ipad applications we are using UISplitViewController.
I want to know that for developing the applications in iphone,what controller to be used for opening a file dialog box when a button is tapped.
For example in composing a mail.In composing a mail,if we want to attach any files from the local drive,we click the "Attach a File" button. Then it will opens a file open dialog box for selection of file what we want.
Can any one help me or suggest me what controller to be used for opening a file in iphone applications?For opening a file dialog box ,in
cocoa applications --------- Controller used is NSOpenPanel
ipad applications --------- Controller used is UISplitViewController
Like wise for i phone applications ------- ??????
Please help me out of this?
iOS doesn't have a concept of browsing arbitrary local files.
It does have the ability to browse for images from the photo library — for that you can use UIImagePickerController.
Other than photos, the only files you can even open are ones that are inside your own sandbox folder (i.e. ones that you've put there yourself). There isn't a built in view controller that will display them — you'd have to write your own that will read the list of files using something like NSFileManager contentsOfDirectoryAtPath:error:, and display them in an appropriate UI.

How to get UIWebView to work properly?

I have been searching around the web for a couple of days to find a tutorial on how to get UiWebView to work with the latest version of xcode.
So far all the newest tutorias tells me to control drag my UiWebView into the .h file, but it wont let me do that.
(First Picture) Showing the problem with control dragging.
http://i.imgur.com/TUGb5.png
Then I tried to manually write the code as seen in the tutorials.
(Second picture) Showing the manually written code.
http://i.imgur.com/iRbUF.png
But it still does not load, just just shows a blank white screen???
Many interwebs to the one that can help me! :)
What you need to do is have them both..
So follow these steps ..
Add a UIWebView to the view in Interface builder
Click and drag from the WebView to the #interface class and you will see a small pop up saying add Outlet
Now release the click ..and it will ask you to name the Outlet
After you have named it(let say mywebView ) ..change
[webView loadrequest:];
to
[mywebView loadrequest:];

iphone webview show html with images and css file

I found some interesting URL http://cubiq.org/rotating-wheel-for-your-iphone-webapps which has rotational menu. Its good. It has html file along with images, css files etc.
In iPhone app, I copied (to root folder) all the files and imported to project. I'm using UIWebView's load request to load the html. But I'm not getting the rotatable menu.
Can some one post me the code (or tutorial or prototype or example) on how to use it?
Also let me know how to catch the even on click on "OK" button at the middle of the html.
Thanks in advance.
checkout IUI : http://code.google.com/p/iui/