Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Break on reload #3

Open
mbeckham opened this issue Mar 27, 2014 · 5 comments
Open

Break on reload #3

mbeckham opened this issue Mar 27, 2014 · 5 comments

Comments

@mbeckham
Copy link

In using this library I have noticed that the functionality breaks when reloading a page or navigating to a new page.

_webView.delegate = self;

javaScriptInterface* interface = [javaScriptInterface new];

[self.webView addJavascriptInterfaces:interface WithName:@"interface"];

interface.webView = self;

[interface release];

[[NSURLCache sharedURLCache] removeAllCachedResponses];

 [_webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"mywebpage.com"]]];

This is the code I use for an initial load of the page. If I call another loadrequest on the same webview the communication between javascript and obj-c stops working. I am working with a web page that is designed to make a lot of calls to these interface functions, and without them the webpage is broken.

This also doesn't work if I try to add a new interface before reloading.

Is there any work around or fix to this? At the moment I am creating a new webview everytime I need to reload and destroying the old one, but would like to use one webview for everything.

@adromil
Copy link

adromil commented Jul 9, 2015

lisun's comment does not work

1 similar comment
@mrcao2011
Copy link

lisun's comment does not work

@gaotai
Copy link

gaotai commented Nov 24, 2015

:(

@Dokely
Copy link

Dokely commented Nov 7, 2018

lisun's comment does not work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants