Skip to content

logisticinfotech/webview-clean-content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

webview-clean-content

Clena UIWebVIew Content

Introduction

Sometimes we may need to clear content loaded on our UIWebView as per our requirements and optimisations.

Generally to do this we will load blank html page without any content but it will take time and load to load html page.

Instead we can easily accomplish this by just single line of Javascription code.

You can find step by step guide from this blog

Here is code for that for Objective C and Swift both.

Objective C

NSString *urlString = @”https://www.google.com/”;
NSURL *url = [NSURL URLWithString:urlString];

NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];

[_webView loadRequest:urlRequest];

Swift

let url = URL(string: “about:blank”)
let requestObj = URLRequest(url: url! as URL)
webView.loadRequest(requestObj)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published