cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacob Weber (JIRA)" <>
Subject [jira] [Created] (CB-4330) handleOpenURL called twice in certain cases
Date Fri, 19 Jul 2013 22:04:48 GMT
Jacob Weber created CB-4330:

             Summary: handleOpenURL called twice in certain cases
                 Key: CB-4330
             Project: Apache Cordova
          Issue Type: Bug
          Components: iOS
    Affects Versions: 2.9.0
            Reporter: Jacob Weber
            Assignee: Shazron Abdullah

I have an app with a custom URL protocol handler. If I load it via the custom URL, it calls
my handleOpenURL JS function, as expected. But if I then change window.location.hash, and
then load another URL in an iframe, handleOpenURL is called again with the same URL.

1. Create an iOS project according to the docs (

2. Add this to the bottom of index.html, before the </body> tag:
{noformat}<button id="test">test</button>
<script type="text/javascript">
	function handleOpenURL(url) {
	var test = document.getElementById('test');
	test.addEventListener('click', function() {
                window.location.hash = 'foo';
		var frame = document.createElement('iframe');
		frame.src = 'img/logo.png';
	}, false);

3. Add this to the end of your HelloWorld-Info.plist file:

4. Run the app.

5. Create a web page somewhere outside of the app, with a link like this:
{noformat}<a href="sample://page">(sample)</a>{noformat}

6. Open the page in Safari and click the link.

7. The app will open, and in XCode's console, you'll see "handleOpenURL: sample://page".

8. Now click the "test" button in the app. This will change window.location.hash, and create
an iframe.

9. In XCode's console, you'll see a second "handleOpenURL: sample://page", which shouldn't

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message