Titanium error loading a webview - asynchronous

I have a problem with the contents of a webview. I'll explain:
I created a webview
var advisor = Titanium.UI.createWebView({
url: 'advisor.html'
});
whose url is an html inside which there one async script that should provide me with a banner ad (I was provided by those who have commissioned me the job and it works!)
This is the script
<ins data-revive-zoneid="1" data-revive-id="a8fd1f1dd1d9f38931672573f40cf0b1"></ins>
<script async src="//mysite.com/www/delivery/asyncjs.php"></script>
when I run the app, the webview me the charge, but by an error on loading the php script files.
Error loading /www/delivery/asyncjs.php
Help me please!

Related

Error: cannot find name "Stripe" in my Next JS app

I'm making an app in next js that requires payments with stripe. When I define stripe like so, It says cannot find name 'Stripe'.
export const stripe:any = Stripe('stripe public key')
I know why this error comes up, because I am importing the stripe js code in my app.jsx file like so.
<script src='https://www.js.stripe.com/v3/'></script>
Despite the error the stripe checkout works just fine, but I can't deploy my code by running npm run build with the error. Any ideas?

Broken styles issue with React-snap

We have created a web app using react native web. We want to add a server-side rendering to our app. We have added a code to render the page server-side, but it's not working, I can see the blank white page in the network preview tab and the server only sends my index.html file as a response.
I found some articles that are suggesting to use prerendering of the app.
To add prerendering to our app I tried react-snap (https://www.npmjs.com/package/react-snap), a snapshot is created but when I started the app it's only loading the first page(landing page) of the app, No events are working on this page(click events) and styles are also missing, there is no way to navigate in the app.
Expectations: The app should be server-side rendered, I should see the snapshot of the page in the network preview, the server should return a snapshot of the page in the response.
Can anyone suggest a solution to fix this?

How do I scrape a Meteor webapp?

I have a Meteor webapp. (e.g. http://www.merafi.com). I want to scrape the website using Google Apps Script. I wrote a small script for this.
function myFunction() {
const url = 'http://www.merafi.com';
const response = UrlFetchApp.fetch(url, {muteHttpExceptions: true});
return response.getContentText();
}
The script is used inside a Google Spreadsheet as a macro.
=myFunction()
The problem with scraping a Meteor webapp is that I get an empty body with only script tags within it. How do I get the content inside the body tag?
Some crawler like PhantomJS or NightmareJS is required to run the Meteor JS after the page is loaded. Unfortunately, Google Apps Script environment does not allow to load external dependencies / packages. The Apps Script API does not have any method which loads a page in a separate iframe / webview. This is not possible using Google Apps Script.
Thanks to #Floo and #CodeChimp for answering the question in comments.

Following links in a course on SAP successfactors app

We're developing SCORM content for our client to put on their SuccessFactors LMS, and access through the SuccessFactors app on ipads.
Some of the course pages include links to pages on the internet and the clients intranet, but we're finding that these links will replace the course in the app's web view, and we aren't able to return to the course.
Has anyone found a way around this, so we can open the links in a new window and keep the learner in the course?
The Successfactors iOS app should work similarly to other iOS apps.The following code forces the iOS app to open a URL in the Safari browser. I believe it may also open in the default browser. Please try this code:
<div id="launchInBrowser" data-href="https://stackoverflow.com/posts/37790430">Stack Overflow</div>
and in the page's javascript:
document.getElementById("launchInBrowser").addEventListener("click", function(evt) {
var a = document.createElement('a');
a.setAttribute("href", this.getAttribute("data-href"));
a.setAttribute("target", "_blank");
var dispatch = document.createEvent("HTMLEvents");
dispatch.initEvent("click", true, true);
a.dispatchEvent(dispatch);}, false);
check here for more information:
Force link to open in mobile safari from a web app with javascript

Remote iframe issues in Metro application

I've seen this SO posting about using iframe's and doing postMessage: Metro App and iFrame cookie. I'm trying to do something very similar in Win8 Release Preview with an HTML/JS Metro application, but it seems rather impossible to replicate the behavior in that solution.
I have a simple frame stored in a remote location as:
<!DOCTYPE html>
<html>
<body>
<script>
window.onmessage = function(e) {
alert("Hello world");
debugger;
};
</script>
</body>
</html>
In my default.html I have a div that contains the iframe as follows:
<div id="container">
<iframe id="frame" src="https://dl.dropbox.com/u/75275447/win8Frame.html"></iframe>
</div>
I have an arbitrary button that executes a postMessage on #frame and would in a normal Html site trigger the remote frames onmessage, but instead I can look at the error list in VS and see:
APPHOST9613: The app couldn’t navigate to
https://dl.dropbox.com/u/75275447/win8Frame.html because of this
error: RESOURCE_NOT_FOUND.
I have tried looking into any manifest that might allow me to achieve this and enabled:
Home or Work Networking
Internet (Client & Server)
Internet (Client)
To no avail... I have also tried having a frame (local to the application) loaded into the web contenxt (via ms-wwa-web://) that contains a div that hosts the remote iframe and chain up onmessage to forward a postMessage to the remote iframe, but again I see another error:
APPHOST9624: The app can’t use script to load the
ms-wwa-web://frame.html/ url because the url launches another app.
Only direct user interaction can launch another app.
I'm beginning to think this is an impossible task.
The one piece of information I leave out as I considered it unrelated to this issue was an error found in the javascript console related to using Jquery that I found a solution in another SO post. Clearing up that issue now allows the app to load the remote iframe and I can press the button and see the message reach the remote iframe's javascript (in my case I see alert() being undefined, but I was just trying to prove that I could load and execute remote code).
I guess the moral of the story is clear up related javascript console errors...

Resources