Ok guys I want my webview to show the current url of the page it's on. So I went to:
https://developer.apple.com/library.../DisplayWebContent/Tasks/LocationChanges.html
To find out how to do it. I set up my webview to load apple.com when it's finish launching and I placed this into the - (void)applicationDidFinishLaunching method. it works fine it loads apple.com. But I want to show the current url as a string in a NSTextField so I connected a Outlet to a NSTextField and named it urltext. Then I used the method from apple's web site:
But some how it's not working can anyone help me?
https://developer.apple.com/library.../DisplayWebContent/Tasks/LocationChanges.html
To find out how to do it. I set up my webview to load apple.com when it's finish launching and I placed this into the - (void)applicationDidFinishLaunching method. it works fine it loads apple.com. But I want to show the current url as a string in a NSTextField so I connected a Outlet to a NSTextField and named it urltext. Then I used the method from apple's web site:
Code:
- (void)webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame
{
// Only report feedback for the main frame.
if (frame == [sender mainFrame]){
NSString *url = [[[[frame provisionalDataSource] request] URL] absoluteString];
[self.urltext setStringValue:url];
}
}
But some how it's not working can anyone help me?