readium / SDKLauncher-iOS

A small iOS application to serve as a launcher/testbed for the Readium SDK.
BSD 3-Clause "New" or "Revised" License
71 stars 47 forks source link

links no longer work #52

Open duanwalker opened 9 years ago

duanwalker commented 9 years ago

i am using test epub "0130 - rtl progression and vertical writing tests" in the links sections (links-rtl-010 - links-rtl-030) the links no longer open their respective webpages. this used to work correctly but no longer work in build 0.17.2

iPad iOS 7.1.2

danielweck commented 9 years ago

Just to double-check, I tried the cloud reader and it works fine: http://readium-cloudreader.divshot.io/?epub=epub_content%2Fepub30-test-0130-20140611.

I must admit, I never tested external hyperlinks in the native application launchers. Would that normally result in opening mobile Safari on iOS? (or does the linked webpage open within the embedded WebView?)

nodehack commented 9 years ago

Links will open in the embedded WebView unless you tell the WebView not to load the request and open the request via: [[UIApplication sharedApplication] openURL:theRequest.URL]. That should open the link in Safari or if its a mailto link it will open the mail application.

I've run into this issue with WKWebView as well. If you comment out the following code in jQuery then external links will work again. This however has a side effect that internal links (such as those found in a ToC) will cause odd behavior around navigating prev/next pages. Something odd is afoot!

    if ( !(eventHandle = elemData.handle) ) {
        eventHandle = elemData.handle = function( e ) {
            // Discard the second event of a jQuery.event.trigger() and
            // when an event is called after a page has unloaded
            return typeof jQuery !== strundefined && (!e || jQuery.event.triggered !== e.type) ?
                jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
                undefined;
        };
        // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
        eventHandle.elem = elem;
    }