1. kratzer999's Avatar
    Hi.

    How would i block a webView from opening links from domains other than ones i specify?
    01-14-14 11:09 PM
  2. Benjamin Black's Avatar
    The easiest way to accomplish this would probably be to drop in a ready made Javascript from any of the various free Javascript archive sites around the Web. Cascades doesn't allow you to do that natively so you would have to either go Javascript or c++

    Posted via CB10
    kratzer999 likes this.
    01-15-14 01:40 AM
  3. mikeo007's Avatar
    In your config.xml file, use the <access> tag to determine what external domains (if any) you want your web view to be able to access.

    https://developer.blackberry.com/htm...s_element.html
    01-15-14 12:51 PM
  4. kratzer999's Avatar
    In your config.xml file, use the <access> tag to determine what external domains (if any) you want your web view to be able to access.

    https://developer.blackberry.com/htm...s_element.html
    this is for webworks. im talking about native for bb10
    Last edited by kratzer999; 01-15-14 at 03:09 PM.
    01-15-14 02:44 PM
  5. kratzer999's Avatar
    The easiest way to accomplish this would probably be to drop in a ready made Javascript from any of the various free Javascript archive sites around the Web. Cascades doesn't allow you to do that natively so you would have to either go Javascript or c++

    Posted via CB10
    can you please point me to a script out there?
    01-15-14 03:21 PM
  6. textngo's Avatar
    Not sure about a JS route but this is an overview of how it can be done through qml

    Restrict webView to one domain? - BlackBerry Support Community Forums
    01-22-14 06:52 PM
  7. Benjamin Black's Avatar
    Not sure about a JS route but this is an overview of how it can be done through qml

    Restrict webView to one domain? - BlackBerry Support Community Forums
    I've done something similar in a webview to hide the webview and show a "login successful " label and doing it this way has incredibly varied performance sometimes it takes up to 15 seconds to notice the url has changed and carry out the effective action. I imagine the way suggested it would let the entire external domain load before it would consider the url changed. That makes for a really crappy user experience. I will look and see if I can find any JS that would help you do this.

    Posted via CB10
    01-22-14 07:05 PM
  8. MobileMadness002's Avatar
    Too bad we aren't permitted to edit the hoats file.

    Posted by my device of choice. Might be a BlackBerry, might not be. It is of concern to you.
    01-22-14 07:12 PM
  9. textngo's Avatar
    I did update that thread with a better example, this checks the url when navigation is requested... as Benjamin Black mentioned it can be a little slow... but it works =)

    Place this code inside a webview.
    Code:
    property string mUrl
    onNavigationRequested: {
             console.log("NavigationRequested: " + request.url +  " navigationType=" + request.navigationType)
             mUrl = request.url
             if (mUrl.indexOf("facebook.com") > -1){
                     console.log("Url Matching")
                     request.action = WebNavigationRequestAction.Accept
             } else {
                     console.log("Url !Matching")
                     mainWeb.url = "http://www.facebook.com"
                     request.action = WebNavigationRequestAction.Accept
              }
    }
    Last edited by textngo; 01-23-14 at 03:43 PM.
    01-23-14 11:37 AM
  10. kratzer999's Avatar
    Any1 can help me out at this hour?

    how would i whitelist another domain?

    property string mUrl
    onNavigationRequested: {

    mUrl = request.url
    if (mUrl.indexOf("url1.com") > -1){

    request.action = WebNavigationRequestAction.Accept
    } else {
    blockedLink.show();
    webViewScrollable.reload()
    request.action = WebNavigationRequestAction.Accept
    }
    }
    08-26-14 01:47 AM
  11. kratzer999's Avatar
    Anyone can help me with the above?

    Posted via CB10
    09-18-14 03:57 PM

Similar Threads

  1. How to pull Android logs from your BlackBerry
    By Cobalt232 in forum BlackBerry 10 OS
    Replies: 48
    Last Post: 05-08-17, 09:15 AM
  2. How to get snap?
    By Sargon123 in forum More for your BlackBerry 10 Phone!
    Replies: 17
    Last Post: 01-27-14, 07:23 PM
  3. What To-Do updated to v2.3 - Offers enhancements, new features, and more!
    By CrackBerry News in forum CrackBerry.com News Discussion & Contests
    Replies: 1
    Last Post: 01-18-14, 09:26 PM
  4. How Can I Get Instagram on my Z10?
    By Katie Brown1 in forum BlackBerry 10 Apps
    Replies: 11
    Last Post: 01-14-14, 12:09 PM
  5. How to reset parental control pin.? Now cannot buy apps
    By Mhafiz Jaminan in forum BlackBerry Z10
    Replies: 3
    Last Post: 01-14-14, 08:43 AM
LINK TO POST COPIED TO CLIPBOARD