PhoneGap: open link outside the phonegap app [duplicate] - iphone

This question already has answers here:
phonegap open link in browser
(12 answers)
Closed 9 years ago.
i am trying to have a link in my PhoneGap app, that when a user click/touch the link a page is being open in the user's browser (doesn't matter which one) as long as it opens outside the phone gap app.
I tried this:
<a href="#" onclick="openUrlInBlankBrowser();" target="_system" >LINK</a>
Doesn't work :( what am i doing wrong?
Thanks for your help,
-- Travis

Try this code, I hope this works for you.
<script>
function loadPage(url) {
if (url === 1) {
window.parent.location ="https://facebook.com/";
} else {
window.parent.location =" https://twitter.com/";
}
}
</script>
<a style="display:inline-block; text-decoration:none" onclick="loadPage(1)" href="#">
<img src="images/logo_facebook.png" target="_blank" style="display:inline-block;"/>
</a>
OR you can try
<a href="#" onclick="window.open('http://iphonedevlog.wordpress.com', '_blank', 'location=no');">
without location bar
</a>

Related

Fb Pages embedding plugin not load

I'm trying to use the plugin
https://developers.facebook.com/docs/plugins/page-plugin/
to load the timeline of a page on a php site
I also created at https://developers.facebook.com
an app ... and I put it live
but nothing has changed.
it's strange because on some computers it works, on others it doesn't
how it doesn't work on mobile.
I don't understand why.
the error message makes me think that the problem is browsers blocking the plugin and I tried to follow this, to catch the problem.
Facebook Sdk blocked : How to detect if a user is using Ghostery?
the code taken from fb is the following:
<div id="fb-root"></div>
<script async defer crossorigin="anonymous"
src="https://connect.facebook.net/it_IT/sdk.js#xfbml=1&version=v15.0&appId=536891684570335&autoLogAppEvents=1" nonce="Y1MwGcHs"></script>
<div class="fb-page" data-href="https://www.facebook.com/autodriveskicup/" data-tabs="timeline" data-width="500" data-height="725" data-small-header="true" data-adapt-container-width="true" data-hide-cover="true" data-show-facepile="true">
<blockquote cite="https://www.facebook.com/autodriveskicup/" class="fb-xfbml-parse-ignore">
Autodrive Ski Cup
</blockquote>
</div>
the result can be seen here:
www.autodrive.org
Can anyone help me?
I just want the plugin to load the timeline
or alternatively be able to read the error and hide the fb div and show an alternative image when the plugin doesn't work

Force webpage to open outside facebook

I don't want my webpage to open inside facebook. It doesn't function quite right.
Is there a way to list a url that when reached, redirects to my external site that is NOT is the facebook interface?
I have tried uploading a php file with a redirect in it, but it makes no difference.
<script type="text/javascript">
window.top.location.href = "http://aurumhairstylists.co.nz";
</script>
<p>If you are not automatically redirected here is a link to <a target="_blank" href="http://shereewalker.com">shereewalker.com</a>. Opens in a new tab or window.</p>
Any help would be great
Thanks
IT is possible but the browser would block the page as a action not "requested by the user".
this is a VERY simple implementation:
<script>
function myFunction() {
var myWindow = window.open("http://aurumhairstylists.co.nz", "myWindow", "width=400, height=200");
}
</script>
<IMG SRC="1x1.gif" ALT="" HEIGHT=1 WIDTH=1 onLoad="myFunction()">
cheers

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.

How can I redirect automatically to an other page of my WebApp

I am currently developing a Web App under jQTouch, and I want to know how I should proceed to redirect the user automatically to another page of my Web App.
For instance, let's suppose I have this code :
<div id="foo1">
...
</div>
<div id="foo2">
...
</div>
Now, let's suppose that the currently visible block is foo1. Which code should I write in my JavaScript file to redirect to block foo2 (as though I clicked a link with href="#foo2")?
Thanks and sorry for my English (I'm French).
You may use the jQT.goTo() to transfer to another page, e.g.
jQT.goTo('#foo2', 'slideup');
If you just want to trigger a click event on a link, you could use the click function in jQuery:
<a id="goToFoo2" href="#foo2">Go To Foo2</a>
<script>$("#goToFoo2").click()</script>
A standard link
Link
will not work, but you are on the right track, it just has to be in the correct setting (either a button, or a list). so either:
<ul class="rounded">
<li class="arrow">
Link
</li>
</ul>
or
<a class="button" href="#foo2">Link</a>
will work.

iphone web app to automatically redirect to app [duplicate]

This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
Rails: redirect_to 'myapp://' to call iOS app from mobile safari
I am trying to do what Facedialer does when it installs small webapps on your home screen so by clicking them it places a call.
I have my app with its custom url scheme working. If I try writing my custom url from safari it opens my app.
But I can't make it so the web app, when opened, redirects to my custom app.
I've tried with window.location.href="myapp://" and a lot of different variants without success.
The only way I have to make it is through META REDIRECT tag. But I need to avoid this solution since I want to discriminate if the user is opening the webapp from the home screen or if it's directly from safari. (using window.navigator.standalone)
Does it make sense?
Any advice?
Thanks
Reposting from: Rails: redirect_to 'myapp://' to call iOS app from mobile safari
have you tried window.location?
Sample:
<html><head>
<script type="text/javascript">
var userAgent = window.navigator.userAgent;
if (userAgent.match(/iPad/i) || userAgent.match(/iPhone/i)) {
window.location = "myiosapp://"
}
</script>
</head>
<body>
Some html page
</body>
</html>