IOS save PDF after accessing from WebView, Cordova - ios

I have an app that displays me a website (uiwebview). In that website i have some LINKS that open me pdf s in webview. What do i want is... can i make, if i'm pressing on a link, pdf to download it instead of open it? Thank you.

Could you perhaps put some code up? It might to understand your requirement a bit better

Cordova-PDFReader-IOS
To install from command line:
cordova plugin add com.lesfrancschatons.cordova.plugins.pdfreader
Supported URI scheme: file For other schemes, please download it first with cordova plugin fileTransfer.
//Open a pdf
PDFReader.open('absolutepath.pdf', options, success, error);
//Available options
{
password: null,
flatUI: true,
showShadows: true,
enableThumbs: true,
disableRetina: false,
enablePreview: true,
bookmarks: true,
landscapeDoublePage: true,
landscapeSingleFirstPage: true,
toolbarBackgroundColor: null,
textColor: null,
enableShare: false,
page: 2
}
//Event when PDF Reader is closed
document.addEventListener('PDFReaderClosed', function() {console.log('closed');})
//Clear PDF Reader cache
PDFReader.clearCache(filePath, finishedCallback);

Related

Share Sheet in iOS not showing Image of the website

I have implemented an Ionic project in which you can share a link to the social media using the Native Share action sheet link popup in ios. All works well except that when the sharing window is open(the native ios window) i dont see the image of my website. What could be wrong?
I am using Ionic 4 and https://ionicframework.com/docs/native/social-sharing plugin.
I am creating the Branch link using below code
data: {
'custom_bool': true,
'custom_int': Date.now(),
'$og_title': 'project name',
'$og_description': 'some text' ,
'$og_image_url': this.projectData.projectImage,
"$custom_fields": {"projectId": this.projectData.projectId},
}
};
branch.link(linkData, (err, link)=> {
console.log(link);
this.projectData.shareURL = link;
// use this URL in another page, some logic
})
using the Plugin (SocialSharing) I am doing the below code
socialSharing.share("some text", "some text", null, 'this is the previous obtained URL')
This is what I mean by icon not seen

"Not allowed to load local resource" with file image URL in Electron app

I am working on a note taking Electron app that uses Markdown. Currently, I'm working on inserting images into notes (using the Markdown syntax).
When inserting an image, my main process copies the image into the notes directory, then returns a file:/// URL to the image file. However, when I try to render the image, it doesn't load - and I get the error Not allowed to load local resource: file:///Users/joe/notes/images/foo.jpg.
Is there a way I can configure Electron to allow these local image URLs?
Option 1
Turning the web security off
mainWindow = new BrowserWindow({
height: 563,
useContentSize: true,
width: 1000,
webPreferences: {
webSecurity: false
}
});
Option 2
You can create your own protocol like this answer
Also here is the user that answered that question
You need register a file protocol to remove the file:/// prefix.
import { protocol } from "electron";
app.whenReady().then(() => {
protocol.registerFileProtocol('file', (request, callback) => {
const pathname = decodeURI(request.url.replace('file:///', ''));
callback(pathname);
});
});
https://github.com/electron/electron/issues/23757#issuecomment-640146333

bootstrap-fileinput with ASP.NET MVC - Form Submit

I wanted to use this plugin (bootstrap-fileinput) to do some simple file upload. Now I'm pretty sure I removed the most to keep a simple file upload via form submit.
script type="text/javascript">
$("#input-id").fileinput({ 'maxFileCount' : 1,'showUpload': false, 'showPreview': false, 'uploadAsync': false, 'showRemove': false, 'showClose': false, 'showCaption': false });
</script>
Still it seems to wanna upload something Asynchronously. It throws a javascript error: Error error not found undefined
Looking in the network log of chrome I see it wants to do this:
Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:64251/File/UploadFile
Why does it do this? What am I forgetting? I just want to upload the file data when I click the submit button and let it then process everything by the controller. Not asynchronously and not via ajax.
Thanks for the help

dailymotion api mobile website issues

I am trying to play embed videos in my webpage, in desktop browser there is no problem, but in mobile version I have these issues:
Video wont start automaticaly
There is Dailymotion logo in right bottom corner
I am using DM object provided by file https://api.dmcdn.net/all.js.
Code:
<script src="https://api.dmcdn.net/all.js"></script>
<script>
DM.init({
apiKey: 'correct api key',
status: true, // check login status
cookie: true // enable cookies to allow the server to access the session
});
</script>
<div id="player{$img->getId()}" class="dailymotion tile"></div>
<script>
$(function () {
var player{$img->getId()} = DM.player(document.getElementById("player{$img->getId()}"), {
{var DMurl = explode("/", $img->getImgUrl())}
video: {$DMurl[count($DMurl) - 1]},
width: "100%",
height: "100%",
params: {
autoplay: true,
mute: true,
endscreen-enable: false,
ui-logo: true,
controls: false
}
});
player{$img->getId()}.play();
});
</script>
My problem might be caused by syntax error in params (endscreen-enable and ui-logo, phpstorm is showing syntax error because of '-' char)
Video wont start automatically
=> this is normal on mobile devices, it will be the same for any video you add, from any provider. The reason is that most mobile devices prevent videos from being played automatically, hence the play must be triggered by a user interaction. This is detailed on Dailymotion developer website at : https://developer.dailymotion.com/player/faq#player-faq-autoplay-does-not-work-on-mobile
There is Dailymotion logo in right bottom corner
=> you pass ui-logo: true so this is normal !

how to embed youtube video using jwplayer without youtube page

i have problem with jwplayer
problem if i open video at my script from phone it show youtube video page
how to hide this page and show only my page
my code for jwplayer
<script type="text/javascript">
jwplayer("container").setup({
file:"{$file_url}",
image: "{$file_image}",
autostart: "false",
aboutlink:"http://elfnoon.com",
abouttext:"elfnoon.CoM Player",
allowscriptaccess:"always",
height: {$height},
width: {$width},
logo: {
file: '{$siteurl}/player/logo.png',
link: '{$siteurl}',
position: 'bottom.right',
hide: 'false',
margin: '-35',
linktarget: '_blank',
hide: 'false',
over: '10',
out: '0.75'
},
wmode:"opaque",
volume:"100",
icons:"true",
bufferlength:"900",
related: {
file: '{$siteurl}/jw6-related.xml',
onclick: 'link'
},
modes:[
{ type:'html5' }
]
});
</script>
test link
with open page from cumputer it show my script normaly
but if from phone it show youtube page
same friends tell me use api but the script for public videos so not know how to make api for my site to embed video using my player with my settings
i forget , how i test my player using html5 because it show only swf version :(
same help plz?
If you use JW6, this should work - http://support.jwplayer.com/customer/portal/articles/1406725-youtube-video-embed

Resources