- Use cordova.InAppBrowser.open('http://apache.org', '_blank'); -- this will display a web view over your app, and provide the user with the ability to close it when done. You can inject your own additional JS if you need. See docs: cordova-plugin-inappbrowser
- What you could do is do link replacement when you receive the story information. If you add the content to an element outside the DOM tree, you could easily query for all links (something like Array.from(df/*: documentFragment*/.querySelectorAll("a[href]")).forEach(el => /* do something */); )
- I would avoid round-tripping like that; instead intercept your form submission (form.addEventListener("submit", handler)) and execute an XHR (XMLHttpRequest) instead (or use the fetch API). Process the return result as needed. OR, use inAppBrowser.open() and listen for loading events. Your main web view should never navigate away from your local context.
Are you using some sort of framework, like jQuery? Most will have features that make using XHR easier.
Hope that helps some?
Thanks. That does give me some more things to chew on and research.
I am using jquery.
This may explain a lot ... I thought I was submitting my form to the script below. As you can see, it's supposed to take the URL from the form action to process. (this is in reference to #3)
I just figured out that my form submission was going straight to the server. Having never done this before, I just ASSUMED it was going to the script and then my response was staying on the server.
So now I just need to figure out how to trigger this script ... I'm thinking of wrapping it in a function, if I can figure out how, pass in the URL, and call it through my script that handles page rendering.
var postData = $(this).serializeArray();
var formURL = $(this).attr("action");
url : formURL,
data : postData,
success:function(data, textStatus, jqXHR)
error: function(jqXHR, textStatus, errorThrown)
e.preventDefault(); //STOP default action
e.unbind(); //unbind. to stop multiple form submit.
$("#AjaxForm").submit(); //Submit the FORM
Sadly, this returns me to the same problem I was having last week but thought I resolved ... my false submission was a mirage ... problem persists.
My form isn't passing its variable values.
I've got my form submission problem fixed.
As Kerri said in a previous thread ... the form needs to be submitted to an ajax function on the same page. No action attribute in the form.