how to get url from browser in blackberry? - url

In BB when user typed any URL into the browser and hit enter.... then is it possible to get/track/fetch that url..???
shuld i implement any ineterface in my application.......that can track, when user opens the browser and passes a url.
I just want to tell that my application will run in the background......and from background I want to get the URL from BB's native browser. Means when user open the browser and pass a url, I have to get that url and check whether my Application should block that or not.
My application need is -
1) get the url, whatever user have typed in the browser field of the browser...
2) send that url to the server, in the form of xml
3) check response from the server......
4) if response value is "yes" then do nothing...
5) but if response value is "no" then block that URL ( regiseter that - URL into HttpFilterRegistery )
I have develop the code to add my own menu-item into the Browser.
By clicking on that custom-menu-item, I am receiving the URL successfully. But this doesn't meet my requirement actually.
As I told earlier, I want to track the browser application pro-grammatically through a third party application. So Is there any way, whenever Browser app comes to foreground, we can get the menu-item instance of the Browser (native application). So that I can run the custom menu item pro-grammatically.
I have used the following code:
Screen screen = Ui.getUiEngine().getActiveScreen();
System.out.println("\n\n**** " + screen.getClass().getName());
Menu menu = screen.getMenu(1);
for (int i = 0, cnt = menu.getSize(); i < cnt; i++)
System.out.println(" menu item : " + menu.getItem(i).toString());
System.out.println("\n\n");
I am successfully tracking the applications whichever comes to foreground through a background thread of my application, but even then My third party application's thread can't get the menu-instance of the foreground-native applications. It always return the instance of my application's screen...
output of the above code :
** mypackage.AppDemoScreen
menu item : Show Keyboard
menu item : Switch Application
menu item : Full Menu

you can use ApplicationDescriptor , and here is an example to add a new menu item with with the ability to avoid duble the custem menu item , also the code to recept the data from the browser and send it to the class you want
http://pastebin.com/BTSBL8AN

Related

How to change the behavior of the "Sign In" button of the OAuthCard to just open the URL without redirect

I have the Webchat (from the Microsoft Bot Framework) running embedded in another application that uses a browser under the hood.
When trying to add Authentication to the bot, I realized that the OAuthCard's Sign-in button doesn't work because is trying to open a blank window (about:blank) that is used to redirect the user to the login page of the identity provider. In the embedded context, the OS doesn't know how to handle the about:blank call. See the image below.
I'm following this example, that it is actually working on the browser:
Add authentication to a bot
Bot authentication example
I want to know if there is a way to change the behavior of the "Sign In" button of the OAuthCard to just open the sign-in URI directly without using the about:blank and redirect technique.
I was able to make it work after finding out that was possible to change the button type of the OAuthCard from "signin" to "openUrl" before the Webchat does the rendering.
There seems to exist a similar issue with Microsoft Teams. Here where I found the clue:
https://github.com/microsoft/botframework-sdk/issues/4768
According to the Webchat reference, it is possible to intersect and change the activities:
https://github.com/microsoft/BotFramework-WebChat/blob/master/docs/API.md#web-chat-api-reference
Here is the solution, that is more like a hack. I hope this would be configurable in the future:
// Change the button type in the OAuthCard to the type of OpenUrl
const store = window.WebChat.createStore( {}, ( { dispatch } ) => next => action => {
if (action.type == "DIRECT_LINE/QUEUE_INCOMING_ACTIVITY" &&
action.payload.activity.hasOwnProperty("attachments") &&
action.payload.activity.attachments[0].contentType === "application/vnd.microsoft.card.oauth") {
action.payload.activity.attachments[0].content.buttons[0].type = "openUrl";
}
return next( action );
});
// Pass the store to the webchat
window.WebChat.renderWebChat({
...,
store
});

Google Apps Script link to a new page removes company tag from url

I have created a multi page app to use internally within our company.
However for some of my colleagues when using the app, whenever they click on a link to be directed to a new page, Chrome removes our company tag from the URL.
Normally the URL should be https://script.google.com/a/macros/**companyname.eu**/s and then the Script ID. But for some reason Chrome removes the **companyname.eu** part from the URL.
In the GScript I use the following code to make sure correct page is displayed -
function doGet(e) {
if (e.parameters.v == 'wishes' || e.parameters.v == "agents" || e.parameters.v == 'markets' || e.parameters.v == 'team_leads'){
let tmp = HtmlService.createTemplateFromFile(e.parameters.v);
return tmp.evaluate();
} else {
let tmp = HtmlService.createTemplateFromFile("wishes")
return tmp.evaluate();
}
}
And then in the HTML files for the links themselves I am using the following code -
<header>
Pending Wishes
Agents
Markets
Team Leads
</header>
For the same people using Safari instead of Google Chrome seems to fix the Issue.
Edit: Picture of the Publish Settings
The WebApp URL depends on how you publish the WebApp
If you set Who has access to the app: to only myself or Anyone within {Your domain}, the WebApp URL will be of type
https://script.google.com/a/YOURDOMAIN/macros/s/XXXXX/exec
If you set Who has access to the app: to Anyone or Anyone, even anonymous, the WebApp URL will be of type
https://script.google.com/macros/s/XXXXX/exec
For your domain, please publish set the access to Anyone within {Your domain} and make sure that your domain users only open it when signed into their browser session with their domain account

Microsoft edge shows the URL when new tab is opened - extension

I have made an extension for chrome, which opens a specific website when new tab is opened. However it works fine with chrome, but when the same extension (with changes in manifest to make it compatible with edge) is tested on microsoft edge, then on opening a new tab it loads the website, but also loads the url in the website, which I don't want. I want to website to be loaded, but not the URL, as chrome doesn't load the url. I have done something like :
CHROME:
chrome.tabs.onCreated.addListener(
function(tab){
var newTabURL = {url: 'http://www.example.com'};
if(tab.url === "chrome://newtab/")
{
// chrome.tabs.update(newTabURL);
}
console.log(tab.url);
}
);
EDGE:
function handleCreated(tab) {
var newTabURL = {url: 'https://www.example.com'};
browser.tabs.update(newTabURL);
}
browser.tabs.onCreated.addListener(handleCreated);
When a new tab is opened, the url is loaded, but I dont want the url to be shown.
It is against Microsoft's Extension policy that any Extension which tries to override a Net Tab Page it wouldn't be approved into Store and you wont be able to publish it.
Coming to your problem, it is not possible as of now to make the Address Bar blank or not to show any url.

jquery mobile page isn't working with localstorage

Phonegap
Jquery mobile
Not working on chrome browser or iOS.
I'm trying to implement "Recent History" functionality, where if a user visits a page, the page title will be stored in localStorage, then retrieved later.
I have a button on a page, that when clicked adds a (key,value) to localstorage.
$(document).on('tap','#getMeThere',function(){
var title = $('#serviceTitle').text();
var duplicate = false;
for (var i = 0; i < window.localStorage.length; i++){//check if service is already in storage
if(window.localStorage.getItem(window.localStorage.key(i)) == title){
duplicate = true;
break;
}
}
if(duplicate == false){//does not exist in array
window.localStorage.setItem(title,title); //add to local storage
}
});
I have another button on a different page, that when clicked, loads a new page and displays all items in localStorage in a list view.
$(document).on('pagebeforecreate', '#recent', function(){//display services that user has visited
if(window.localStorage.length == 0){
console.log('local storage length=' + window.localStorage.length);
$('#recentEmpty').text("You haven't visited any services yet! Any services you visit will show up on this page.");
}
else{
for (var i = 0; i < window.localStorage.length; i++){
$("#recentList").append($("<li><a href='#ymca' data-transition='slide'>YMCA</a></li>"));
}
console.log('local storage length=' + window.localStorage.length);
}
});
Case 1: The problem is if say i open my app. I click the 2nd button, to see "You haven't visited...". That's fine. Then i go to another page and click the 1st button to add a value to localStorage. When i click the 2nd button again, i'm supposed to see one list item, instead i still see "You haven't visited". Even though i can see while inspecting element that localStorage.setItem was successful and there is 1 value in localStorage. I need to refresh the browser in order to see the list item.
Case 2: I open my app, click the 1st button to add to storage, then click the 2nd button to display it, my recent history page correctly shows 1 list item, without needed to refresh.
It seems to be some sort of caching issue. Or maybe i need to somehow refresh the page?
You are using pagebeforecreate, which is run before the page is created, which happens once. You probably want pagebeforeshow.

Timed click link rather than timed redirect

the action I need is after 1 min (and only once, not every minute), a link click is performed, opening the page. I cannot have this as a page redirect. The reason, the test page you can see below, requires a video background to not start over after the 1 minute AND the page opening with instructions to the user.
I need the action to be the same as if the user clicked the link (if they clicked the link, the page would open and the background video would not start over)
http://kartbattle.com/tester - if you click the link on the top right, the page opens but the video doesn't start over....
if you redirect to the page http://kartbattle.com/tester/?page_id=23 the video starts over which I cannot have happen.
thx!
Using javascript:
setTimeout(function(){window.open('http://kartbattle.com/tester', '_self', '', true)}, 60000);
EDIT:
You will still need to use javascript. First add an id attribute to your hyperlink:
<a id="auto-click" href="http://kartbattle.com/tester/?page_id=23">
then add in the following line to your onLoad handler:
setTimeout(document.getElementById('auto-click').click();, 60000);
this should achieve what you are looking for.

Resources