PhoneGap is not able to open the internal link.In my html I am using href tag But unable to load the webpage..Can anyone please suggest how to redirect one html page to another html page in phonegap ?
You can try this.
Code ::
HTML
Next Page
Javascript
<script type="text/javascript">
function goToNext() {
window.location.href = './NextPage.html';
}
</script>
Hopefully, This will help you for navigating to a new page.
Thanks.
How About redirecting page automatically in iphone?
For example, i have used $.mobile.changePage("login.html"); based on jQuery Mobile, but the app just displays a blank page.
Whether to use $.mobile.changePage(); to redirect page in iphone?
It runs well in Android.
Related
I have a problem with AddThis widget and History.js script.
Once user shares some page on Facebook using AddThis widget, some hashtag is appended to URL (e.g. #.U-S_Q-q0tE8.facebook).
Then, if user clicks such link on Facebook and goes to my website with URL e.g.: http://domain.com/path/to/content,123.html#.U-S_Q-q0tE8.facebook, they get redirected to http://domain.com/path/to/.U-S_Q-q0tE8.facebook which throws error 404.
The weird thing is that History.js is not even initialized or used. It's just embed on the site with <script...> tag.
Is there any solution to this? Is it possible to disable such behavior in History.js?
I have the exact same problem, and while I don't know if you can disable the history.js behavior, you can disable the addthis hashes by adding the following before the addthis script
<script type="text/javascript">
var addthis_config = {
data_track_clickback: false
}
</script>
This means you wont be able to track how many click that link gets using addthis, but something like Google Analytics is able to show traffic source.
Source
I'm trying to do a simple mobile redirect on my site, but I'm getting the error in the title.
The redirect code is simply:
<script type="text/javascript">
<!--
if (screen.width <= 699) {
document.location = "http://bartlettstudio.com/mobile";
}
//-->
</script>
If you visit http://bartlettstudio.com on a phone, you can see that the redirect is indeed working and taking you to http://bartlettstudio.com/mobile, but that /mobile page isn't loading. It will hang and eventually time out and give you the error above.
I assume this is a server/dns setting of some kind, but I don't even know where to look.
Thanks for any suggestions!
Terry
Your script is redirecting the page back to itself. So the question is, why are you redirecting to the mobile page from the mobile page? Need to remove the code from the /mobile page or put something in place to keep it from activating.
I've been working on a problem for the last day and a half now and have still yet to find a solution.
When visitng my game on facebook (which is in facebook's iFrame) php sessions don't work. This is for IE and Safari. Chrome works fine.
I've already read all the posts on stack about this problem, which seems to be down to third party cookie security and needing interaction with the iFrame first. There was a workaround by making javascript post some form data to the iFrame first, but this seems to have been 'fixed' in the latest versions of the browsers very recently as this no longer works.
I even tried implementing a start page that would require them to click a link first (in the iFrame) to load another page which would then create the session. But even THAT doesn't work.
I'm also having trouble even loading new pages in the iFrame using javascript, which seems to always cause infinite loop refreshes.
And no, P3P headers do NOT solve it.
Does anyone have a solution to this problem? I can't be the only one with it, considering how many facebook apps exist!
I came across this problem using a client that had "Accept third party cookies" disabled. My solution was to force PHP to embed the session ID into the URI by putting this line at the start of each page:
ini_set('session.use_trans_sid', true);
As the URLs are in iframe within Facebook the SID is not seen in the top window.
For IE, you will need the P3P Headers set. Something like:
<?php header('P3P: CP="CAO PSA OUR"'); ?>
Safari blocks 3rd-party cookies by default. Currently, the only work-around that is working for me is to "pop-up" a new window to set the cookies. I have something like this:
<script type="text/javascript">
function safariFix(){
if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1){
window.open('https://yourdomainname.com/safari.php', 'Safari Fix','width=100,height=100');
}
}
</script>
And safari.php will have this:
<?php
setcookie("safari_test", "1");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Safari Fix</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
</head>
<script type="text/javascript">
$(document).ready(function(){
window.close();
});
</script>
<body>
Since Safari does not accept third-party cookies by default, we are forced to open this window.
This window will automatically close once we have set the cookies.
</body>
</html>
PROBLEM: This won't work if users have "block pop-ups" enabled in Safari. If anyone has a better solution for this, inform me ;)
I've developed a web app for the iPhone, and I have it bookmarked and added to my iPhone's home screen. I'm noticing a problem with it, though: it works as intended until I navigate to a page within the app that has a query string and parameters - for example, www.mywebapp.com/page02.html?param1=value¶m2=value2 . When I go to a page with such a URL, iOS switches me from the embedded version of Safari to the main Safari app - it takes me out of my app. I don't know why this is happening.
What causes this and what can I do about it?
Many thanks to #BjornKaiser who provided the solution, here is a simple jQuery script that will handle this for you for all links.
Add this to the head section of your master ASP.Net page. Make sure you have jquery included:
<head>
<!-- Your reference to your jQuery library -->
<script type="text/javascript" src="/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
$(function() {
$('a').click(function() {
document.location = $(this).attr('href');
return false;
});
});
</script>
</head>
That's the way Apple designed it. If you need a multi-view Web App you need to implement the page switching logic in JavaScript. Everything else will cause the problem you described -> jumping to Safari.
I'm not sure what causes this, but this question about UIWebView issues has a solution for how to make some links open in the UIWebView page and some open in Mobile Safari, so I bet you could generalize from that to a solution to your problem.
I found the best solution: using client-side data storage. You can use JavaScript to store variables information into the variables localStorage and sessionStorage.
Look at these links:
O'Reilly client-side data storage tutorial and
Apple key-value client-side data storage tutorial for web apps
I have an application at http://www.facebook.com/LovingPets?fbhref=index.php&app_page=1&v=app_190518734309657&sk=app_190518734309657#!/LovingPets?fbhref=treats.php&app_page=1&v=app_190518734309657&sk=app_190518734309657.
I keep getting problems with trying to run JavaScript. I thought that one of the benefits of Facebook adding the iframe to the page tabs is so that you could run JavaScript? When you try to click on the treat catalog link it loads the next page fine, but none of the interactivity works. Looking at Firebug these errors are observed,
script is not an allowed DOM element [Break On This Error] (11 out of range 3)"
and
a190518734309657_l is null [Break On This Error] <script type="text/javascript">
Is it possible to run JavaScript and jQuery the way I have my application setup? And if it is, what am I doing wrong?
Yes, it is possible.
I have been working with jQuery in the new iframe tabs. However, you must update your page to the new layout in order to get them working correctly.
http://www.webtlk.com/2011/02/11/how-to-upgrade-to-the-new-facebook-fan-page-layout-redesign/
Regards