I have a very big web page with many sub pages. Inside html code there is a lot of 's that leads to external pages. I have to transform this pages into phonegap app. Every link has to be open in system browser. I know that in phonegap I should use onclick="window.open(...) but is there any easier way in order not to have modify every singe in my old code(there is hundreds of them)?Phonegap - <a href> open in system browser
0
A
回答
0
If every instance of the <a>
can be overridden, and assuming you have jQuery, try binding all clicks on the <a>
tags.
$('a').click(function(event) {
event.preventDefault();
window.open($(this).attr('href'));
});
0
you can use InAppBrowser plugin
cordova plugin add org.apache.cordova.inappbrowser
then you can use
window.open('http://apache.org','_system');
在系統瀏覽器中打開!
相關問題
- 1. cordova(ex phonegap)tel:鏈接在<a href> not working in ios5
- 2. Toast Notification Arguments Open Web Browser
- 3. 防止在<a href="tel"> in IE
- 4. USB AutoRun:'Open In Browser'選項永遠不會出現
- 5. 當在r上點擊default.aspx時,找不到'open in browser'選項
- 6. AS3 Greensock Chugs in Browser
- 7. PhoneGap 1.2觸發<a href> twice in IOS 5
- 8. Set <a href> name to open a specific video when supplying a link
- 9. 請確保<a href="local file"> is opened outside of browser
- 10. 如何匹配'<a href=' in a string?
- 11. <a href=""> links don't open when I click on it but works when I click "open in new tab"
- 12. Open in new window
- 13. Bootstrap Responsive Site in Browser,not adapted in iPhone
- 14. system()call in cocoa app
- 15. <a></a><a></a>標籤
- 16. 如何使用<a href> tag in JTextPane
- 17. python:if open in open(example.txt)not reading the string
- 18. In標籤<a href="....."></a></td>查詢中的DOUBLE_WHITESPCE href
- 19. 機器人:與<a href> in TextView
- 20. <a click=''> event binding in SPA using router.navigate
- 21. <a href = "tel: becomes malform in GAS html service
- 22. 顯示<A id> Inside placeholder in form
- 23. 如何用<a href.. in PHP
- 24. CSS style for firstin a <tr>
- 25. 保存的<a href> in the localstorage
- 26. 與<a href> tags in Javascript/JQuery
- 27. 獲取使用<a href=... in Firefox
- 28. Escape&in a string?
- 29. Open image in new window
- 30. /system/console/configMgr in CRX/AEM
這只是一個想法,並沒有優化。您可以在點擊鏈接之前定義事件。這個事件會做window.open()並通過返回false來避免鏈接。 – jedema
[InAppBrowser](http://docs.phonegap.com/en/3.3.0/cordova_inappbrowser_inappbrowser.md.html)插件在這種情況下可能會有幫助。 – byJeevan