Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
i'm developing chrome extension
how to get the active tab URL i'm using angular js


popup.js


PHP
var app = angular.module("convertModule", ['chieffancypants.loadingBar']);
var ConvertController = function ($scope, $http, $log) {

    $scope.PageUrl;

    var onError = function (reasone) {
        $scope.error = "could not featch data";

    };

    var onFetchComplete = function (response) {
    };

    $scope.ConvertPage = function (PageUrl) {

        $http.get("http://test.com?save=" + PageUrl)
         .then(onFetchComplete, onError);
    };
};
app.controller("ConvertController", ConvertController);






popup.html

XML
<!doctype html>
<html ng-app="convertModule" ng-csp>
<head>
    <meta charset="UTF-8">
    <title>test</title>


    <link href="css/loading-bar.css" rel="stylesheet" />

</head>
<body ng-controller="ConvertController">



    <form name="convert" ng-submit="ConvertPage(PageUrl)">
        <input type="url" placeholder="http://www.url-of-Page.com" class="form-control" ng-model="PageUrl" required />
        <div class="form-actions">
            <input type="submit" value="convert" class="btn" />
        </div>
    </form>

    <script src="js/chrome-api-vsdoc.js"></script>
    <script src="js/vendor/angular.min.js"></script>
    <script src="js/vendor/angular-route.min.js"></script>
    <script src="js/loading-bar.js"></script>
    <script src="popup.js"></script>
</body>
</html>
Posted
Comments
Afzaal Ahmad Zeeshan 26-Jun-15 10:48am    
Angular is just a framework, it has nothing to do with the active tabs. Read the documentation.
TheSniper105 26-Jun-15 11:02am    
ok how to get the active tab using pure js
Afzaal Ahmad Zeeshan 26-Jun-15 11:04am    
You cannot. JavaScript is not meant to allow you to manipulate the browser windows. It allows you to trigger some commands, on your website.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900