iOS 歷史瀏覽網頁的定向跳轉

2022-09-13 15:12:11 字數 1333 閱讀 4051

在實際的開發過程中,涉及到互動的問題,原生和h5的網頁相互巢狀,直接造成跳轉的混亂,混亂就應該指定的歷史記錄中,就需要網頁的一些相關的一些屬性問題

需要在webview裡面的**方法中執行相對應的操作跳轉過程

nsurl *list =[webview.backforwardlist itematindex:0].initialurl;

nslog(@"%@",list);

nsurl  *current =[webview.backforwardlist currentitem].url;//當前的url

nsurl *foreward = [webview.backforwardlist forwarditem].url;

nsurl *back = [webview.backforwardlist backitem].url;//後退的url

nslog(@"current=%@,foreward=%@,back=%@",current,foreward,back);

nsarray *history = [webview.backforwardlist backlist];//歷史記錄的列表

//迴圈遍歷裡面歷史記錄,根據標題返回到指定的歷史記錄中

for (wkbackforwardlistitem *item in history) {

nslog(@"000%@---111%@----222%@",item.url,item.title,item.initialurl);

//標記  標題是我的資訊的時候,返回到指定的頁面,下面是陣列中的第乙個元素,也就是說最先載入的乙個位址

if ([item.title isequaltostring:@"我的資訊"]) {

[webview gotobackforwardlistitem:[webview.backforwardlist.backlist firstobject]];

//根據標題的頁面執行對應的跳轉頁面

for (int i =0; iwkbackforwardlistitem *item = history[i];

if ([item.title isequaltostring:@"個人中心"]||[item.title isequaltostring:@"發現"]) {

self.tag = i;

if ([item.title isequaltostring:@"我的資訊"]||[item.title isequaltostring:@"活動詳情"]||[item.title isequaltostring:@"發現"]) {

[webview gotobackforwardlistitem:history[self.tag]];//跳轉想對應網頁的操作

棧 網頁瀏覽歷史

輸入描述 輸入包含多組資料,每組資料第一行包含乙個正整數n 1 n 100 緊接著有n行,每一行包含一條指令。其中url是不包含空格 長度不超過100的非空字串。輸出描述 對應每組資料,為每條指令輸出當前頁面的url。每組資料之後輸出乙個空行作為分隔。示例1 13 visit visit visit...

HTTP臨時重定向(網頁跳轉)

http臨時重定向 http重定向 伺服器無法處理瀏覽器傳送過來的請求 request 伺服器告訴瀏覽器跳轉到可以處理請求的url上。瀏覽器會自動訪問該url位址,以至於使用者無法分辨是否重定向了。重定向的返回碼3xx說明。location響應首部包含了內容的新位址或是優選位址的url。狀態碼 1....

Express URL跳轉(重定向)的實現

express是乙個基於node.js實現的web框架,其響應http請求的response物件中有兩個用於url跳轉方法res.location 和res.redirect 使用它們可以實現url的301或302重定向。res.location path 下面列舉了幾種,設定http響應頭loca...