Open new html page inside phonegap app - html

The thing with phonegap is that it uses it's own API via phonegap.js that is declared at the head of the index.html page.
When using window.open and it's alternatives, the new page will forget anything from the previous one, and phonegap's API would no longer be accessible.
What is the right way to open a new html file?
I really find it hard to believe that phonegap apps have to be one huge html file.

Does your phonegap app need to open a new page? The idea of phonegap is 1-page app. Meaning that to change the view, you don't need to reload the whole DOM tree. Rather you load your DOM only once and then manipulate objects inside it.

You can move to another html page by this code:
window.location = "NewFile.html";

Related

Is there a way to access the HTML of an In App Browser (Themeable Browser)

I am using the ionic framework and would like to be able to read from the HTML from the current webpage and then send the selection back to my application.
I have the Theme-able Browser Plugin setup and can use it like any other web browser.
I have tried looking at ways to include my own script with the .executeScript() function but no luck.
I have also tried to read data from custom buttons that I have inserted into the tool/nav bar but that gives me the HTML of my application.
TL;DR: (Basically want access to the DOM of the current webpage and have the user use native selection to read the document.getSelection() and send that text back to my application.)
Any help would be highly appreciated.
After browsing the forums on Ionic I found the solution:
browser.executeScript({code:'window.getSelection().toString();'}).then((selection)=>{
packet.text = selection[0];});
This allows me to get the selection.

Is it possible load a cshtml file in an iframe on non-cshtml page?

I'm working on an outlook 365 app for the web client of outlook. In outlook, you can define a button above the email that opens a panel when clicked. This panel is basically and iframe. The issue is, I need to point that frame at a cshtml file, which you can't do unless the page the iframe is on is also a cshtml file from what I understand.
My question is though, is there a way to load a cshtml file in an iframe on a page that is just a regular, plain html file? If the answer is no, as I suspect it is, is there a different way of doing this or is there a way to get around this?
I've searched high and low on google to try and even find an answer and there is nothing.
You can call the cshtml view through the asp.net routing
<iframe src="/controller/Action"></iframe>
if you want to be able to call views without calling actions
you need to override HandleUnknownAction
https://stackoverflow.com/a/8372820/1551411

How to Access DOM of new web page opened in Chrome

i am writing a NPAPI plugin for that i am using NPSIMPLE sample code from google chrome. i have to get the DOM of web page opened in the chrome browser. My plugin solution also includes background.html file. which when i open in chrome browser calls a method in NPAPI plugin. so my plugin can get the URL of this file. now i want to read the DOM structure of this File.
i have few questions:
when a new page is opened in browser by user how i have to embed my plugin to that page and get the DOM of that page?
whenever a new tab is opened how can i get the notification in My plugin?
How to get the DOM mutation notification to my plugin?
Does NPAPI provides API to get the DOM mutation notification or Content Script is the only option? if content script is the only option then how to establish communication between plugin and content_script?
i am trying to get this answers as well. any help greatly appreciated...
thanks in advance...
1) The only way you could do this automatically would be to put the plugin inside an extension and do it with the extension.
2) You can't, since plugins don't know anything outside of the page they are in. You might be able to jury-rig something using an extension, I suppose, but I'm not sure if that's possible or not.
3 and 4) Your best bet is probably to figure out how to get these notifications with javascript and inject javascript that will call back into your plugin.
Sounds like one of your main sticking points is that you aren't clear on what a plugin can do; you may want to read up a bit.

jQuery mobile single page template loading content via ajax

I'm creating mobile app with phonegap, google maps and jquery mobile. I would like to have more then one single html templates files (navigation for pages) and load just the content of the page via ajax to javascript overlay.
Also i want to keep the history and hashes to be able to go back to previous page etc. I tried using $.mobile.loadPage and changePage but this is changing the whole pages and i would like to change just the content.
Is there any solution?
You will find this framework the exact one you are looking for.

Passing data between two html pages in phonegap

I'm using phonegap to create mobile app.
I don't want to have everything in one html page so I created few of them. Each one has .js file attached. How can I send data between these html pages?
The most portable and simplest way to do it is to use localStorage. There is a bug in Android for passing parameters along in the URL so I don't recommend using that method.