I learned make link in DPS.
Like below
<a href="navto://article/xxarticlenamexx"> article </a>
I want to send next page some parameters, so I changed the link like below
<a href="navto://article/xxarticlenamexx?param1=test"> article </a>
And I write javascript
$('body').html(window.location.href);
but parameter was disappeared and I can't get any parameters.
Url string end with "****/index.html" and "?param1=test" was disappeared.
Is there any method of send parameters to next page?
Having this functionality would make my life significantly better. Please let me pass data across navto links like mutsuyuki is asking for here.
Views
Replies
Total Likes
You could achieve this with HTML localStorage. Here's an example:
In article A with the navto link to article B:
<a href="javascript:navtoHandler('article/xxarticlenamexx', 'test')">Click me</a>
<script>
function navtoHandler(strNavToUrl, strCustomParam) {
// sets the parameter for "param1" in HTML localStorage
localStorage.setItem('param1', strCustomParam);
// redirect the window using the navto
window.location.href = 'navto://' + strNavToUrl;
}
</script>
In article B (with article name 'xxarticlenamexx'):
// wait until the DOM is ready
$(document).ready(function() {
// makes sure that the code is loaded everytime and not cached in iOS
window.onAppear = function() {
if (localStorage.getItem('param1') === null || localStorage.getItem('param1') === '') {
// the "param1" is empty, should ignore
} else {
// there is a value for "param1", so retrieve it
var strCustomParam = localStorage.getItem('param1');
// TODO: do something with the value for "param1"
// after the action, remove the value for "param1" from HTML localStorage
localStorage.removeItem('param1');
}
};
window.onAppear();
});
- Mike