开发者

Get the current URL of Cocoa's WebView

开发者 https://www.devze.com 2023-03-27 12:14 出处:网络
Im new to Cocoa. I\'m trying to extract the URL of the currently loaded webpage in my WebView object. I use this WebView to show a login screen and after logging in I have to get some parts of the UR

Im new to Cocoa.

I'm trying to extract the URL of the currently loaded webpage in my WebView object. I use this WebView to show a login screen and after logging in I have to get some parts of the URL.

I have already tried

[[[[frame provisionalDataSource] request] URL] absoluteString];

but this one on开发者_运维知识库ly works one time, when called while loading. If the loading is complete it returns "(null)". The problem is, that it seems like the URL changes while loading the page so i get the wrong URL.

Does anybody know how to get the URL at any time I want?

Thanks


Switch provisionalDataSource with dataSource. Once the frame starts loading, it's not provisional anymore.

0

精彩评论

暂无评论...
验证码 换一张
取 消