Quantcast
Viewing all articles
Browse latest Browse all 3527

Javascript function not working within a href tag

I am working on WP8.1. Where I am using webview. The data comes from the server and I am loading the content using webview.NavigateToString(). The script contains following

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>

</body>

  <script type="text/javascript">
    function Action()
{
window.external.notify('hi');
}

document.write('<a href="javascript:Action();">test</a>');
  </script>
</html>

This code contains calling javascript function from "a href" tag. So whenever the user clicks that javascript function will be called. But in Wp8.1 whenever i click on the image, the javascript function is not called. I tried registering with onclick()

  <a onclick="Action();">

This is working. But as per project is concerned (consistency across all platforms) the client will be giving in

  <a href="javascript:Action();"> javascript function.

The above function working fine on IE10,IE11 on the desktop but is not working on IE11 on windows phone 8.1.

Loading the content into Webview and clicking the tag doesn't fire ScriptNotify event.

Please help.

 

Viewing all articles
Browse latest Browse all 3527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>