I’m trying to view a pdf in my app. I already test the google viewer and work perfect but I need to convert the links from http://myWebpage.com/pdf/Mypdf.pdf to https://docs.google.com/gview?embedded=true&url=http://myWebpage.com/pdf/Mypdf.pdf But I don’t know how to do this…
I try this:
<WebView Url="{urlWV}">
<PageBeginLoading>
<Callback Handler="{VerificarUrl}" />
</PageBeginLoading>
</WebView>
and in Js:
var urlWV = Observable("");
function VerificarUrl(){
debug_log("-Url-: " + urlWV.value);
if(urlWV.value.indexOf("/pdf/") > -1){
var Newurl = urlWV.value;
urlWV.value = "https://docs.google.com/gview?embedded=true&url=" + urlNueva;
}
}
But this don’t work. I get the previus url in my debug_log
.
Its possible to achieve this?
Thanks!
Here a example:
The html contains a link (http://www.goodfactory.cl/linkPdf.html):
<a href="http://www.goodfactory.cl/pdf/MyPdf.pdf">Link PDF</a>
And the app:
<App>
<ClientPanel>
<DockPanel>
<JavaScript>
var Observable = require('FuseJS/Observable');
var urlWV = Observable("http://www.goodfactory.cl/linkPdf.html");
function VerificarUrl(){
debug_log("-Url-: " + urlWV.value);
if(urlWV.value.indexOf("/pdf/") > -1){
var Newurl = urlWV.value;
urlWV.value = "https://docs.google.com/gview?embedded=true&url=" + urlNueva;
}
}
module.exports = {
urlWV: urlWV,
VerificarUrl: VerificarUrl
};
</JavaScript>
<Text TextColor="#000" TextAlignment="Center" FontSize="20" Dock="Top" Value="My WebView:" />
<NativeViewHost>
<WebView Url="{urlWV}">
<PageBeginLoading>
<Callback Handler="{VerificarUrl}" />
</PageBeginLoading>
</WebView>
</NativeViewHost>
</DockPanel>
</ClientPanel>
</App>
I always get http://www.goodfactory.cl/linkPdf.html
in the Monitor…