Code Monkey home page Code Monkey logo

Comments (14)

ninjinkun avatar ninjinkun commented on July 19, 2024

@SPopenko Thanks reporting. I'll check that website.

from njkwebviewprogress.

ninjinkun avatar ninjinkun commented on July 19, 2024

@SPopenko I've tried several times to access Toysrus site, and problem happened only one time. I'm looking for condition what caused this problem. Do you know how to represent it?

from njkwebviewprogress.

SPopenko avatar SPopenko commented on July 19, 2024

@ninjinkun I think that it happens when page has error in load and system trigger didFailLoadWithError

Most probably it could be when block executed twice for the same page. On error and on start load triggers.

    if (interactive) {
        _interactive = YES;
        NSString *waitForCompleteJS = [NSString stringWithFormat:@"window.addEventListener('load',function() { var iframe = document.createElement('iframe'); iframe.style.display = 'none'; iframe.src = '%@'; document.body.appendChild(iframe);  }, false);", completeRPCURL];
        [webView stringByEvaluatingJavaScriptFromString:waitForCompleteJS];
    }

from njkwebviewprogress.

ninjinkun avatar ninjinkun commented on July 19, 2024

@SPopenko Thanks to your suggestion. It represented under bad network with Network Link Conditioner. I'll try to solve it.

from njkwebviewprogress.

stevemckenzie avatar stevemckenzie commented on July 19, 2024

I'm noticing an issue like this as well where sometimes a page doesn't reach 100%. Some will get about half way, some will only reach 10%.

If you attempt to view a github.com page, this can happen. Could this be related to history API?

from njkwebviewprogress.

stevemckenzie avatar stevemckenzie commented on July 19, 2024

I can confirm the problem for me is related to your JS on load event listener. The iframe never loads so the completeRPCURL is never requested.

A small change I made that is looking reliable, instead of using an iframe, just using a window.location:

[NSString stringWithFormat:@"window.addEventListener('load',function() { window.location = '%@'; }, false);", completeRPCURL];

from njkwebviewprogress.

SPopenko avatar SPopenko commented on July 19, 2024

Hey @ninjinkun, do you think solution suggested by @stevemckenzie good enough to integrate it in the new release? :)

from njkwebviewprogress.

ninjinkun avatar ninjinkun commented on July 19, 2024

@stevemckenzie window.location = causes to override UIWebView referred URL.
But your suggestion was big hint. I found incomplete problem is caused by Content Security Policy. They refused iframe from other domain.
I'm planning that fall back to window.location when iframe is refused, or change PRC URL scheme and domain to content URL.

from njkwebviewprogress.

SPopenko avatar SPopenko commented on July 19, 2024

@ninjinkun this sounds like a good plan. Could you let us know please when you make new release?

from njkwebviewprogress.

stevemckenzie avatar stevemckenzie commented on July 19, 2024

@ninjinkun but because you return NO in the shouldStartLoadWithRequest delegate method, isn't it fine? I've used this method to relay info back to the delegate before.

from njkwebviewprogress.

ninjinkun avatar ninjinkun commented on July 19, 2024

@stevemckenzie You are right. I even thought window.location affects current URL. But I can't find any problem with shouldStartLoadWithRequest returns NO as your suggestion.

I research two methods again.

  • window.location or location.href
    • can handle single request
  • IFrame

NJKWebViewProgress can use both two methods for single complete request.
However, I don't want to change method for conservative reason. Currently IFrame works fine without the site using Content Security Policy. And this CSP problem can avoid with #27. I want to go using proven IFrame method.
Do you have any reason to use window.location?

@SPopenko I made pull request with new RPC URL for avoid Content Security Policy. Please try this version. #27

from njkwebviewprogress.

SPopenko avatar SPopenko commented on July 19, 2024

@ninjinkun thanks for this pull, it looks like it works for me! 👍

from njkwebviewprogress.

ninjinkun avatar ninjinkun commented on July 19, 2024

@SPopenko Thank you!

from njkwebviewprogress.

minhtriphung avatar minhtriphung commented on July 19, 2024

@ninjinkun
I'm sorry so long time for issue.
I use new source NJKWebViewProgress on GIT. but this issue still happen. Can you support me how to fix it. thanks!

from njkwebviewprogress.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.