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

Set iframe src to content:// url failing silently #38

Closed
thebarge opened this issue Dec 14, 2015 · 14 comments
Closed

Set iframe src to content:// url failing silently #38

thebarge opened this issue Dec 14, 2015 · 14 comments

Comments

@thebarge
Copy link

Hi,
I really appreciate this plugin -- it's made my life a lot easier! I do have one question/potential issue.

We have set up a simple app, and the premise works great -- we can load images from the expansion pack, etc.

However, one of the key things we are trying to do is set an iframe's src to an html file that is in the expansion pack, and this is failing silently. Our initial assumption was that this was some type of security restriction, but we followed the instructions in the readme at https://github.com/agamemnus/cordova-plugin-xapkreader/blob/cordova-5.3.1/README.md. We are using your whitelist plugin.

We are setting the iframe's src using simple javascript: $("iframe")[0].src = "content://com.cloudkid.expansion/main_expansion/(path)/index.html".

We aren't seeing any output in any log, either using adb logcat or inspecting it via Chrome.

We have also tried with and without the crosswalk plugin, and it makes no difference.

We can get the contents of the html file in the expansion pack using jQuery.get("content://(path)/index.html") and verify that the html file exists.

Is this a known issue? We can create a simple version of our app with non-proprietary content if that would help diagnose things. Please let me know if you need more details. Thanks!

@agamemnus
Copy link
Owner

Shouldn't you have a . after the 0?

If it's not that, go ahead and make a sample project that I can run. I'll
check it out.
On Dec 14, 2015 11:19 AM, "Matt Bargar" notifications@github.com wrote:

Hi,
I really appreciate this plugin -- it's made my life a lot easier! I do
have one question/potential issue

We have set up a simple app, and the premise works great -- we can load
images from the expansion pack, etc

However, one of the key things we are trying to do is set an iframe's src
to an html file that is in the expansion pack, and this is failing silently
Our initial assumption was that this was some type of security restriction,
but we followed the instructions in the readme at
https://githubcom/agamemnus/cordova-plugin-xapkreader/blob/cordova-531/READMEmd
We are using your whitelist plugin

We are setting the iframe's src using simple javascript: $("iframe")[0]src
= "content://comcloudkidexpansion/main_expansion/(path)/indexhtml"

We aren't seeing any output in any log, either using adb logcat or
inspecting it via Chrome

We have also tried with and without the crosswalk plugin, and it makes no
difference

We can get the contents of the html file in the expansion pack using
jQueryget("content://(path)/indexhtml") and verify that the html file exists

Is this a known issue? We can create a simple version of our app with
non-proprietary content if that would help diagnose things Please let me
know if you need more details Thanks!


Reply to this email directly or view it on GitHub
#38.

@thebarge
Copy link
Author

Hi-
Yeah, that was just bad copy/pasting into the github issue. I made a slimmed-down project, attached as a zip. I have a theory that it has to do with the mime type of the assets, but that theory may be wrong. Thank you so much for any insight you have, I really appreciate it; I've been looking at this for a while now with no luck.

expansionApp.zip

@agamemnus
Copy link
Owner

agamemnus commented Dec 14, 2015 via email

@agamemnus
Copy link
Owner

(I think some changes to the Cordova code might be needed, but I don't remember..)

@thebarge
Copy link
Author

Good idea - I tried removing the whitelist plugin, but no change.

@agamemnus
Copy link
Owner

And when you removed it, you also edited some other code to make that work? Last time I tried removing the whitelist plugin, it wouldn't compile.

@thebarge
Copy link
Author

Yep, it compiled -- I did have to comment out a line in the config.xml -- <plugin name="cordova-plugin-whitelist" spec="1" /> otherwise the build process would try to re-add the plugin.

@agamemnus
Copy link
Owner

Ok, I'll try the zip soon.

@thebarge
Copy link
Author

Thank you so much, I really appreciate it. 😃

@agamemnus
Copy link
Owner

The local load is working correctly?

@agamemnus
Copy link
Owner

What happens when you don't use any parameters? ("?test") I think it is because it can't handle parameters.

@thebarge
Copy link
Author

Hi, the url parameters don't matter, I should have stripped that out of my test.

The local load works correctly for me - if you tap on the 'game 1' button you should see some text overlaid on top of the image. (The text is the content from www/assets/games/localGame/index.html.)

@thebarge
Copy link
Author

Ha! I figured this out. My suspicion about the mime-type was correct -- to test in a hacky way, I switched the mime-type from "vnd.android.cursor.item/asset" to "text/html" in XAPKProvider, and commented out the mime-type check in DownloadThread (lines ~679-685). Doing that, I was able to see basic html, at least. Progress.

I'm going to fork the code for now (https://github.com/SpringRoll/cordova-plugin-xapkreader). Thank you!

@agamemnus
Copy link
Owner

I wonder if there's an easy way to just make it use the correct mime-type... I will think about this, but let me know about your progress too, so I can integrate it.

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

2 participants