Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- window.location.href('http://www.wordreference.com');
- function loadHTML(url, timeout) {
- if (timeout == undefined)
- timeout = 10000;
- var req = new XMLHttpRequest();
- var timer = setTimeout(function() {
- try {
- req.abort();
- } catch(e) {}
- navigator.notification.loadingStop();
- },timeout);
- req.onreadystatechange = function() {
- if (req.readyState == 4) {
- if (req.status < 300) {
- clearTimeout(timer);
- var html = req.responseText;
- //just a debug print
- alert(html);
- document.write(html);
- }
- navigator.notification.loadingStop();
- delete req;
- }
- };
- req.open('GET', url, true);
- req.send();
- }
- loadHTML('http://www.wordreference.com',10000);
- loadHTML('http://www.mysite.com/cgi-bin/index.py',10000)
- <access subdomains="true" uri="http://www.mysite.com/" />
- - (BOOL)webView:(UIWebView *)theWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
- {
- return [super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType];
- }
- - (BOOL)webView:(UIWebView *)theWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
- {
- NSURL *url = [request URL];
- if ([[url scheme] isEqualToString:@"http"] || [[url scheme] isEqualToString:@"https"]) {
- return YES;
- }
- else {
- return [ super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType ];
- }
- }
- /**
- * Load PhoneGap configuration from res/xml/phonegap.xml.
- * Approved list of URLs that can be loaded into DroidGap
- * <access origin="http://server regexp" subdomains="true" />
- * Log level: ERROR, WARN, INFO, DEBUG, VERBOSE (default=ERROR)
- * <log level="DEBUG" />
- */
- private void loadConfiguration() {
- [...]
- <?xml version="1.0" encoding="UTF-8"?>
- <phonegap>
- <access origin="http://stackoverflow.com" subdomains="true" />
- </phonegap>
- public class AndroidActivity extends DroidGap {
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- try
- {
- super.loadUrl("file:///android_asset/www/index.html");
- this.appView.addJavascriptInterface(new JavaScriptInterface(), "EXTERNALLINK");
- }
- catch(Exception lException)
- {
- throw new RuntimeException("hello hello", lException);
- }
- }
- class JavaScriptInterface
- {
- public void loadExternalLink(String lUrl)
- {
- try
- {
- loadUrl(lUrl);
- }
- catch(Exception lEx)
- {
- int i = 0;
- }
- }
- }
- }
- super.setIntegerProperty("backgroundColor", Color.WHITE);
- super.setStringProperty("loadingPageDialog", "Loading page...");
- super.setBooleanProperty("loadInWebView", true);
- addWhiteListEntry("mydomain.com", true);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement