Hyperlink is not working in my chrome extension - hyperlink

I have made a chrome extension where user login and its favorite shops are being displayed, now I want to user to be log out when it will click on log out button, I am calling a javascript function but it is not working.
Logout Code:
<a href='#' onclick='DeleteCookies('memberid');'>Logout</a>
When I debug it in chrome editor then it says
Refused to execute inline script because of Content-Security-Policy.
Besides this I was trying to user should go to main website when he will click on an image but that link was also not working, all is that hyperlinks are not working.
What should I do to resolve this? can any one tell me its solution? i will be very thankful to him.

Yeah you cannot use inline script in extensions. Give an 'id' to your link and in a separate javascript file write on click function for that 'id' and include this javascript file in your html head section.

Related

Why aren't styles loading in second page in jQuery mobile?

Below is the part of screenshot of mywebsite/index.php, a PC site with NO jQuery Mobile (JQM), with all scripts and styles.
Below the screenshot of mywebsite/mobile/options.php, a page designed to be run on mobile browsers, having JQM.
Here is the HTML script for Logout button, actually an ahchor tag:
Logout
.. refers to the main mywebsite folder out from mobile folder.
When I tap/click Logout, it should go to mywebsite/index.php, the PC site. And here's what shows up:
If I display the location using alert(document.location);, it shows - mywebsite/mobile/options.php.
I have to press F5 to view the page as it should.
I know that this is happening because JQM loads the pages AJAXually and hence ignores all scripts and stylesheets outside of BODY tag. I know this question is duplicate of many questions in StackOverflow and I have tried my level best to find a solution, but can't find one.
How do I move to the index.php without need to refresh?
You need to add additional code to your logout.php file to execute after the logout code executes. PHP headers can accomplish this. Within your PHP tags, add this to the end of your code:
header( 'Location: http://mywebsite/index.php' ) ;

<a href link doesn't open when clicked on. it only works if I right click and then open in new tab

So I'm still learning, and I can't figure out why my links won't work. If I click "open in new tab", it does work. I'm trying to link to another external page.
I've read that this could be due to another linked js file... but what js code could effect links like this?
I mean if I'm going to go through all my other files I'd rather know what I'm looking for.
Here is my link:
visit
FYI, no links work for external URLs, but it works when I use links to navigate around my own website.
check you achor link. That is lacking of closing tag </a>

Selenium Webdriver-Unable to interact with any element in the webpage

i am trying to click on the button links in the webpage http://stage.pressrun.prod.europe.s3.amazonaws.com/preprod/appstudiowidgets/index.html#issue/idmlintegration/landscape/1 but not able to do so.
Can anyone please provide the webdriver code in clicking any of the links in the page.
Thanks

How to Auto Login to a web-site?

Hello,
I need to login to a web-site automatically. It is a dashboard. Is there a URL link code which I can create as shortcut link or VBScript code to achieve this? Also is there a AppleScript for MAC?
Here's an example of a javascript bookmarklet that creates a form hidden in a div at the bottom of the current page and then submits it. (I included a time stamp cause many dashboard logins include a hidden timestamp field in the form.)
javascript:self.moveTo(0,0);self.resizeTo(screen.availWidth,screen.availHeight);document.body.appendChild(document.createElement('div')).innerHTML='<form%20name="BletForm"%20method="POST"%20action="https://secure.mysite.com/index.asp?action=login"><input%20type="hidden"%20name=“domain”%20value=“mydomain”%20/><input%20type="hidden"%20name="username"%20value=“myname”%20/><input%20type="hidden"%20name="password"%20value=“mypassword"%20/><input%20type="hidden"%20name="hidDateTime"%20id="idhidDateTime"%20value=""%20/></form>';document.getElementById('idhidDateTime').value=+new%20Date()%20/1000%20|0;document.forms%5B'BletForm'%5D.submit();
You can use that code along with do javascript in safari for an Applescript solution. Something like:
set jsCode to "document.body.app..."
tell application "Safari"
do JavaScript jsCode in current tab of window 1
end tell

Downloadable files using jQuery mobile

I'm fairly new to jquery mobile, and am getting an error when trying to link a file in my jquery mobile project for download. I would like a user to be able to download a .zip file from the app, but get either a page loading error, or undefined displayed in a new page. I tried using an anchor tag to link the file to download, but it doesn't seem to work right. I know jquery mobile makes use of the anchor tag, so I don't know if there is something special that needs to be done. Any help?
You are likely getting the exception when jQuery Mobile assumes the link is a page and attempts an AJAX page load. Disable AJAX loading on the link.
Link
And I have no idea what the typical mobile browser will do with a link to zip file.

Resources