ionic app not loading updated html when using iframe - ionic-framework

I have an html page in ionic that loads another html file from S3 using iframe. my ionic html looks like this:
<ion-view view-title={{header1}}>
<div class="item item-divider item-{{colorTheme}}">Privacy policy</div>
<ion-content class="padding has-header">
<iframe ng-src="http://backoffice.taralets.com.ph.s3-website-ap-northeast-1.amazonaws.com/partials/partial-privacyPolicy.html"
style="height:100%; width:100%;overflow:hidden;"
height="100%"
width="100%"></iframe>
</ion-content>
</ion-view>
After my initial testing, the html file from S3 is being displayed correctly. Here is the html file in S3:
<div class="text-left">
<h2>Privacy Policy</h2>
<p>Apps Privacy Policy</p>
</div>
The problem that I am having is that when I change the content of the html file in s3 - say change "Apps Privacy Policy" to "This is a Privacy Policy", the display in my ionic app is still showing the original content "Apps Privacy Policy". I am debugging this in the browser using ionic serve. Even if I clear the Application site data when doing "inspect" in chrome, the problem still exists. Is there a cache somewhere that's causing this problem? Note that if I try to access the page from our website, it is reflecting the updated content.

Use the below code for disabling cache for the specific page
<ion-view cache-view="false">
you can disable caching globally by using
$ionicConfigProvider.views.maxCache(0);
in your configurations

Related

Scrapy and Javascript sites on Rasbperry Pi

I am trying to scrape a page that is modified by javascript after initial load using Scrapy on Raspberri Pi.
I tried to install docker and scrapinghub/splash to render the page before passing it into scrapy, but realized Splash doesn't support ARM yet. Are there other options to scrape pages using javascript with Scrapy on a Raspberry Pi?
Currently, using the normal scrapy request on the site I only get this html, which is because the site loads first, and then the javascript renders the entire content. So before the javascript the page source looks empty:
<body class="notie8 notie9 lang-{{html.lang}}">
<!--<![endif]-->
<div loading-line></div>
<div page-layout>
<div ng-view></div>
</div>
</body>
</html>
For reference, the site I am referring to is: https://www.sreality.cz/hledani/prodej/byty?region=brno
Sreality uses API, isn't this a way to go? For your URL, there's this API call: https://www.sreality.cz/api/cs/v2/estates?category_main_cb=1&category_type_cb=1&per_page=20&region=brno&tms=1502631428897 (look for XHR requests in your browser's developer tools).

Google DFP ads in email behaving strangely

I am trying out serving DFP ads in email. I'm following the guidelines here.
I have an ad unit set up just for email
I have a line item targeting that ad unit with just an image creative
The line item doesn't have any targeting restrictions or anything like that
The ad will show up in the email, at least the first time. The strange thing that I'm seeing is, after the first click, clicking on the ad again will often bring me to a blank page rather than the click-through page of the creative. Also, when I reopen the message, occasionally the image will not load. The code in the email looks like this:
<a href="https://pubads.g.doubleclick.net/gampad/jump?iu=/{my_pub_id}/300x250_email&sz=300x250&c={cachebuster}&tile=1">
<img src="https://pubads.g.doubleclick.net/gampad/ad?iu=/{my_pub_id}/300x250_email&sz=300x250&c={cachebuster}&tile=1" />
</a>
We've solved this by turning off cookies in the standard tag using the co= option; adding co=1 to the tag.
<a href="https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/{my_pub_id}/300x250_email&sz=300x250&c={cachebuster}&tile=1">
<img src="https://pubads.g.doubleclick.net/gampad/ad?co=1&iu=/{my_pub_id}/300x250_email&sz=300x250&c={cachebuster}&tile=1" />
</a>
The only problem (for us) that this creates is that we're unable to serve 3rd party tags, even ones that resolve directly to .gifs, using the standard tag.
Had the same problem and I solved it by using script to redirect click via script on my web server where ad is shown again so that all the cookies can be set.
Link looks like this:
http://www.mysite.com/dfpclick.php?adunit=mailing&cbuster=1369608725
Script dfpclick.php:
<?php
/* Google DFP url redirect*/
if ($_REQUEST['adunit']) {
$sUrl = 'http://pubads.g.doubleclick.net/gampad/jump?iu=/%mygoogleid%/'.$_REQUEST['adunit'].'&sz=1x1&c='.$_REQUEST['cbuster'];
}
?>
<html>
<head>
<meta HTTP-EQUIV="REFRESH" content="0; url=<?=$sUrl?>">
</head>
<body>
<?php
if ($_REQUEST['adunit']) {
echo '<img src="http://pubads.g.doubleclick.net/gampad/ad?iu=/%mygoogleid%/'.$_REQUEST['adunit'].'&sz=1x1&c='.$_REQUEST['cbuster'].'" width="0" height="0" border="0" style="width:0px; height:0px;" alt=""/>';
}
?>
</body>
</html>
It turns out that DFP for small business requires cookie support to work, even when using the non-JavaScript method of calling ads. So it works fine in web-based clients like Gmail, but it doesn't work in Outlook and the like. DFP Premium can supposedly serve ads in email without requiring cookies.
Using the co= option doesn't work for DFP Small Business. My workaround is:
Use the same code for img <img src="https://pubads.g.doubleclick.net/gampad/ad?iu=/{my_pub_id}/300x250_email&sz=300x250&c={cachebuster}" />
And build a redirect link on your website <a href="http://yourwebsite.com/adunit/300x250_email">. This page reads and filters the response from http://pubads.g.doubleclick.net/gampad/adx?iu=/{my_pub_id}/300x250_email&sz=300x250&c={cachebuster} in order to get the click-tracking link using javascript link=$(xmlDoc).find('a').attr('href'); and redirect.
This workaround doesn't work for rotation (more than one creative/line item is competing for the same ad unit at the same time).
I'd like to know how to serve email ads in rotation using DFP SB

jQTouch Phonegap problems

I am using jQTouch and Phonegap and it perfectly runs in my Xcode and iPhone simulator. What I am trying to develop is to dynamically display external webpages within my application.
For example, when you first run the application it shows table with data "User Interface", "Animations" ... etc. What I want to make is when user taps on "User Interface" it should display some external web pages ( lets say google's home page).
I wrote the following code and this is inside User Interface->Edge to Edge->(here I want to dispaly the home page of google). The width:340 and height:420 will be the display area of google's home page. Please help me to make it.
<div id="edge">
<div class="toolbar">
<h1>Edge to Edge</h1>
back
</div>
<div style="width:340px; height:420px; background:red;">
<ul class="edgetoedge scroll">
<li class="sep">under construction...</li>
</ul>
</div>
</div>
Thank you
You will need to load an <iframe> into the div you want to display the content of the external page.
http://www.w3schools.com/tags/tag_iframe.asp
Make sure to add the external URL to the whitelist (ExternalHosts entry in PhoneGap.plist as per the PhoneGap for iOS FAQ: http://wiki.phonegap.com/w/page/41631150/PhoneGap%20for%20iOS%20FAQ) and set the Boolean for OpenAllWhitelistURLsInWebView to YES.

Server-side response will not show in PhoneGap + jQuery Mobile app

I have a fairly simple jQuery mobile app, which works fine as a web app (tested in browsers on desktops/smartphones) but when porting it to android using phonegap, I have one major issue. It occurs both on a real phone and in an AVD.
there's a form in the app, like:
<div data-theme="a" data-role="dialog" id="a-form">
<div data-role="content">
<h3>...</h3>
<form action="http://a-live-site.com/a-form.php" method="post">
...
<div data-role="fieldcontain">
<button type="submit">Submit</button>
</div>
</form>
</div>
</div>
Its response content loads perfectly in the browser (the action is a relative link there), but within phonegap I just get a white screen and the hardware back button exits the app instead of the usual step back in history. The puzzling thing is that the request actually gets through. The server side code triggers an email, so I know the server is getting the request. I have added the appropriate <access /> rules in the phonegap.xml file, but I'm not sure that's enough.
EDIT: the form is in static content so, in phonegap, it's loaded by file:// and shouldn't have cross-domain issues.
The problem was due to data-role="dialog" in the result. Using page fixed it. It only broke in phonegap and phonegap's logs made it look like it was something else. A real PITA.

Facebook IFrame on page canvas?

Hey guys, I have developed a small site that i would like to embed into a tab on a facebook page.
Previously I used this code to load in an iframe, it worked great:
<a onClick="outside_location.setInnerFBML(link_1);" style="cursor: pointer;">Link 1</a> | <a class="red" onClick="outside_location.setInnerFBML(link_2);" style="cursor: pointer;">Link 2</a>
<div id="outside_location"></div>
<fb:js-string var="link_1"><fb:iframe width="760" height="1280" frameborder='0' src='http://www.WebWhispers.in' /></fb:js-string>
<fb:js-string var="link_2"><fb:iframe width="760" height="1280" frameborder='0' src='http://google.com/' /></fb:js-string>
<script type="text/javascript" charset="utf-8">
var outside_location = d
document.getElementById('outside_location');
</script>
However, it has stopped working. I dont think facebook allows iframe inside of pages, only applications.
How can I load this page in without learning FBML? The site uses Jquery so I cant use FBML anyway.
I know applications can use iFrames, can I make it an application and then embed the application into a page tab somehow?
No. Tab pages can not contain iFrames. They must be written using FBML and FBJS.
One reason for this is that Facebook does not want to enable Tab pages to detect who looks at them. All requests (including images) on tab pages are proxied through Facebook for this reason. If iframes were allowed then the application would be able to detect who looked at it, which would present a privacy issue for Facebook users.
This is either a policy change by Facebook or, more likely, a bug. I say it's unlikely to be a policy change as it throws a script error, whereas a policy change would more likely strip the code out before it's rendered.
There's a bug report you can add votes to and follow here.