How to crawl the content of the page? - javascript

I hope to climb this page, but I don't know why I can't climb it successfully.
I see a nice Web Page, I want to get it, Facebug555
I have no Python background!
I found this script on the Internet, but I don't quite understand how to use this script. May I ask how you should use this script? Or tell me how to learn Python. I think Python is very simple and interesting.
If you can help me, I will be very funny, this thing I have been distressed for a lot of days, please big gods, teach me ok
This is my code: Please help me!!!
header = {
'Accept': 'image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh;q=0.9',
'Cache-Control': 'no-cache',
'Connection': 'keep-alive',
'Cookie': 'BIDUPSID=272A32E33F3DEA7C13D80C8EF8BB2040; PSTM=1628126145;,
'Host': 'mbd.baidu.com',
'Pragma': 'no-cache',
'Referer': 'https://facebug555.com',
'sec-ch-ua': '" Not A;Brand";v="99", "Chromium";v="100", "Google Chrome";v="100"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
'Sec-Fetch-Dest': 'image',
'Sec-Fetch-Mode': 'no-cors',
'Sec-Fetch-Site': 'same-site',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36'}
page_html = requests.get(url='https://facebug555.com/blog', headers=header).text
this result:
<html lang="zh-CN" data-mode="light"><head>
<title>fb账号购买,fb账号,facebook账号购买,fb账号出售,投号玩家</title>
<script charset="utf-8" src="https://hmcdn.baidu.com/static/tongji/plugins/UrlChangeTracker.js"></script><script src="https://hm.baidu.com/hm.js?b2e95e2b202d58ac7eea516a181efdc0"></script>
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta name="format-detection" content="email=no">
<meta name="format-detection" content="telephone=no">
<meta http-equiv="Cache-Control" content="no-siteapp">
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, shrink-to-fit=no, viewport-fit=cover">
<meta name="keywords" content="fb账号购买,fb账号,脸书账号,facebook账号购买,投号玩家">
<meta name="description" content="fb账号购买,fb账号,脸书账号,facebook账号购买,投号玩家">
<meta name="author" content="投号玩家">
<meta http-equiv="x-dns-prefetch-control" content="on">
<meta name="site" content="https://www.facebug555.com/blog">
<meta property="og:image" content="">
<meta property="og:description" content="fb账号购买,fb账号,脸书账号,facebook账号购买,投号玩家">
<meta property="og:type" content="website">
<meta property="og:locale" content="zh_CN">
<meta property="og:site_name" content="fb账号购买,fb账号,facebook账号购买,fb账号出售,投号玩家">
<meta property="og:url" content="https://www.facebug555.com/blog">
<meta property="og:title" content="首页 – fb账号购买,fb账号,facebook账号购买,fb账号出售,投号玩家">
<meta property="twitter:partner" content="ogwp">
<link rel="shortcut icon" size="32x32" href="">
<link rel="canonical" href="https://www.facebug555.com/blog">
<link rel="dns-prefetch" href="https://cdn.jsdelivr.net">
<link rel="apple-touch-icon" sizes="180x180" href="">
<meta name="generator" content="Halo 1.5.1">
<script type="application/ld+json">{
"#context": "http://schema.org/",
"url": "https://www.facebug555.com/blog",
"#type": "BreadcrumbList",
"itemListElement": [{
"#type": "ListItem",
"position": 1,
"name": "fb账号购买",
"item": "https://www.facebug555.com/"
},{
"#type": "ListItem",
"position": 2,
"name": "fb账号购买 博客",
"item": "https://www.facebug555.com/blog"
}]
}</script>
<div id="Joe">
<header class="joe_header">
<div class="joe_header__above">
<div class="joe_container joe_header_container">
<i class="joe-font joe-icon-caidan joe_header__above-slideicon"></i>
<a title="fb账号购买,fb账号,facebook账号购买,fb账号出售,投号玩家" class="joe_header__above-logo" href="https://www.facebug555.com/blog">
<img style="border-radius:4px" src="/upload/2022/02/%E6%8A%95%E5%8F%B7%E7%8E%A9%E5%AE%B6-25169996d5064acb960b5ddc15d13507.png" onerror="this.src='/themes/FaceBugBlog/source/img/logo.png'" alt="fb账号购买,fb账号,facebook账号购买,fb账号出售,投号玩家">
</a>
<nav class="joe_header__above-nav">
<a class="item" href="https://www.facebug555.com" target="_self" title="玩家官网">玩家官网</a>
<a class="item current" href="/blog" target="_self" title="首页">首页</a>
<a class="item" href="/blog/categories" target="_self" title="分类">分类</a>
</nav>
<form class="joe_header__above-search" method="get" action="https://www.facebug555.com/blog/search">
<input maxlength="16" autocomplete="off" placeholder="请输入关键字..." name="keyword" value="" class="input" type="text">
<button type="submit" class="submit" aria-label="搜索按钮"><i class="joe-font joe-icon-search"></i></button>
<span class="icon"></span>
<nav class="result">
<a href="/blog/archives/1020" title="科技快讯【2022年04月28日】" class="item">
<span class="sort">1</span>
<span class="text">科技快讯【2022年04月28日】</span>
</a>
<a href="/blog/archives/1019" title="Facebook的流量高效转化策略" class="item">
<span class="sort">2</span>
<span class="text">Facebook的流量高效转化策略</span>
</a>
</div>
<img width="100%" height="150" class="joe_header__slideout-image" src="/upload/2022/02/facebug-d57a054a38a94005b37f4b98d524486c.png" alt="侧边栏壁纸">
<div class="joe_header__slideout-author">
<img width="50" height="50" class="avatar lazyloaded" data-src="/upload/2022/02/telegram-16744a2dabef42b081f5abaa6c1c1573.png" src="/upload/2022/02/telegram-16744a2dabef42b081f5abaa6c1c1573.png" onerror="this.src='/upload/2022/02/telegram-16744a2dabef42b081f5abaa6c1c1573.png'" alt="博主头像">
<div class="info">
<a class="link" href="https://www.facebug555.com/blog" rel="noopener noreferrer nofollow">投号玩家</a>
<p class="motto joe_motto">一个在facebook江湖闯荡的骨灰级玩家</p>
<li>
<a class="link panel in" href="#" rel="nofollow">
<span>栏目</span>
<i class="joe-font joe-icon-arrow-right"></i>
</a>
<ul class="slides panel-body panel-box panel-side-menu" style="display: block;">
<li>
<a class="link" href="https://www.facebug555.com" title="玩家官网">玩家官网</a>
</li>
<li>
<a class="link current" href="/blog" title="首页">首页</a>
</li>
<li>
<a class="link" href="/blog/categories" title="分类">分类</a>
<div class="joe_header__searchout">
<div class="joe_container">
<div class="joe_header__searchout-inner">
<form class="joe_header__above-search-mobile" method="get" action="https://www.facebug555.com/blog/search">
<input maxlength="16" autocomplete="off" placeholder="请输入关键字..." name="keyword" value="" class="input" type="text">
<button type="submit" class="submit">
搜索</button>
</form>
</div>
</div>
</div>
<div class="swiper-wrapper" style="transition-duration: 0ms; transform: translate3d(-3464px, 0px, 0px);"><div class="swiper-slide swiper-slide-duplicate swiper-slide-duplicate-next" data-swiper-slide-index="4" style="width: 866px;">
<a class="item" href="/blog/archives/1020" rel="noopener noreferrer nofollow">
<img width="100%" height="100%" class="thumbnail lazyloaded" data-src="/upload/2022/04/6a144a3d1c844aa8976e7b80ace9c040.png" src="/upload/2022/04/6a144a3d1c844aa8976e7b80ace9c040.png" alt="科技快讯【2022年04月28日】">
<div class="title">科技快讯【2022年04月28日】</div>
<i class="joe-font joe-icon-zhifeiji"></i>
</a>
</div>
<p>
2022 ©投号玩家
</body></html>
But if I make a post request, I get the following message
<html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>cloudflare</center>
</body>
</html>
it can't get the page code from post request
bug get request can get it
how ? why?
Why????

Related

When ever i am clicking login button my html page is open again on other tab how can i fix this issue?

When ever I am clicking login button my html page is open again on other tab how can I fix this issue?
I have made a html form so when ever I click on login than html page is opening in new tab how to fix this problem
my html code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Contact Us</title>
<link rel="stylesheet" href="style.css">
<script src="script2.js"></script>
<script
type="text/javascript"
src="https://cdn.jsdelivr.net/npm/#emailjs/browser#3/dist/email.min.js"
></script>
</script>
</head>
<body>
<div id="wrapper">
<div class="container">
<div class="phone-app-demo"></div>
<div class="form-data">
<form id="myForm" action="" target="_blank">
<div class="logo">
<img src="./images/logo.png" alt="logo">
</div>
<input type="text" placeholder="Phone number, username, or email" id="email">
<input type="password" placeholder="Password" id="name">
<button class="form-btn" onclick="sendMail()">Log in</button>
<span class="has-separator">Or</span>
<a class="facebook-login" href="#">
<i class="fab fa-facebook-square"></i> Log in with Facebook
</a>
<a class="password-reset" href="#">Forgot password?</a>
</form>
<div class="sign-up">
Don't have an account? Sign up
</div>
<div class="get-the-app">
<span>Get the app.</span>
<div class="badges">
<img src="./images/app-store.png" alt="app-store badge">
<img src="./images/google-play.png" alt="google-play badge">
</div>
</div>
</div>
</div>
</div>
</body>
</html>
Remove the target="_blank" attribute from your form tag to avoid opening in another tab.

Neither BindingResult nor plain target object for bean name 'advertisement' available as request attribute

I bind the data properly but when I run the page and fill the
requirement details and press send button it shows success popup
message, when press okay button success message it redirect me to an
blank support page but my requirement is when press okay button on
success message it redirect me to same support page with all the
design in that page.
here is the error
java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'advertisement' available as request attribute
HomeController
#PostMapping("/support")
#ResponseStatus(HttpStatus.CREATED)
fun contactUS(
model: Model,
#RequestParam(name = "full_name") full_name: String,
#RequestParam(name = "email") email: String,
#RequestParam(name = "comment") comment: String,
) {
val map = HashMap<String, Any>()
map["full_name"] = full_name
map["email"] = email
map["comment"] = comment
postRequestClient(restTemplate, SUPPORT_POST, null, ContactUs::class.java, map) {
print(it)
}
}
ContactUs.kt
package com.ape.model
data class ContactUs(
val full_name:String?="",
val email:String?="",
val comment:String?=""
)
Support.html
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.thymeleaf.org ">
<head>
<meta charset="utf-8">
<meta content="ie=edge" http-equiv="x-ua-compatible">
<meta content="initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width" name="viewport">
<meta content="yes" name="apple-mobile-web-app-capable">
<meta content="black" name="apple-mobile-web-app-status-bar-style">
<meta content="yes" name="apple-touch-fullscreen">
<meta content="telephone=no" name="format-detection">
<meta content="" name="author">
<meta content="" name="description">
<meta content="" name="keywords">
<title>APE :: Support</title>
<!-- ================= Favicon ================== -->
<link href="images/logo.svg" rel="apple-touch-icon" sizes="76x76">
<link href="images/logo.svg" rel="icon" sizes="32x32" type="image/png">
<link href="images/logo.svg" rel="icon" sizes="16x16" type="image/png">
<link href="images/logo.svg" rel="manifest">
<meta content="#da532c" name="msapplication-TileColor">
<meta content="#ffffff" name="theme-color">
<link href="css/style.css" media="all" rel="stylesheet">
<link href="css/responsive.css" media="all" rel="stylesheet">
</head>
<body>
<!-- loader -->
<div class="preloader">
<div class="loader-spin">
<div class="diamonds">
<div class="diamond diamond-1"></div>
<div class="diamond diamond-2"></div>
<div class="diamond diamond-4"></div>
<div class="diamond diamond-3"></div>
</div>
</div>
</div>
<!-- Header -->
<header class="header-wrapper">
<div class="container-fluid">
<div class="header-part">
<div class="logo-part">
<a class="header-logo" th:href="#{/}">
<img alt="" class="img-fluid" src="images/logo.svg">
<h5>ape</h5>
</a>
</div>
<div class="menu-part">
<div class="nav-logo-bar">
<a th:href="#{/}">
<img alt="" class="img-fluid" src="images/navbar-logo.svg">
<h2>APE</h2>
</a>
<p>Advertising Promotional Experiences</p>
</div>
<nav class="full-nav-bar">
<ul>
<li><a th:href="#{/my-rewards}">My Rewards</a></li>
<li><a th:href="#{/about-us}">About Us</a></li>
<li><a th:href="#{/support}">Support</a></li>
<li><a th:href="#{/privacy-policy}">Data Policy</a></li>
<li><a th:href="#{/terms-of-use}">Terms of Use</a></li>
</ul>
</nav>
</div>
<div class="toggle-btn">
<a href="javascript:;">
<svg class="fa-bars" viewBox="0 0 448 512" xmlns="http://www.w3.org/2000/svg">
<path d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path>
</svg>
<svg class="fa-times" viewBox="0 0 320 512" xmlns="http://www.w3.org/2000/svg">
<path class=""
d="M207.6 256l107.72-107.72c6.23-6.23 6.23-16.34 0-22.58l-25.03-25.03c-6.23-6.23-16.34-6.23-22.58 0L160 208.4 52.28 100.68c-6.23-6.23-16.34-6.23-22.58 0L4.68 125.7c-6.23 6.23-6.23 16.34 0 22.58L112.4 256 4.68 363.72c-6.23 6.23-6.23 16.34 0 22.58l25.03 25.03c6.23 6.23 16.34 6.23 22.58 0L160 303.6l107.72 107.72c6.23 6.23 16.34 6.23 22.58 0l25.03-25.03c6.23-6.23 6.23-16.34 0-22.58L207.6 256z"></path>
</svg>
</a>
</div>
</div>
</div>
</header>
<div class="content-area-container page-ath-wrap">
<div class="page-ath-content container-fluid" th:object="${contactUsPage}">
<div class="page-ath-form">
<div class="page-ath-heading">
<h3>We’d love to hear from you.</h3>
<p th:text="*{content}"></p>
</div>
<div class="singup-form">
<form id="form_support" action="javascript:;" th:action="#{/support}" method="post">
<div class="form-group">
<label for="full_name">Full name</label>
<input type="text" name="full_name" id="full_name" placeholder="Your name" class="form-control"
/>
</div>
<div class="form-group">
<label for="email">Email address</label>
<input type="email" name="email" id="email" placeholder="you#example.com" class="form-control"
/>
</div>
<div class="form-group">
<label for="comment">Comments</label>
<textarea name="comment" id="comment" cols="30" rows="8" placeholder="Your comments"
class="form-control"></textarea>
</div>
<button type="submit" class="btn-default bg-blue w-100 mt-5" data-toggle="modal"
data-target="#supportmodal">Send
</button>
</form>
</div>
</div>
</div>
</div>
<div class="modal fade" id="supportmodal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog support-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-body">
<div class="support-modal-text">
<h5>Thank you!</h5>
<p>We’ve received your message and we’ll get back to you within 24 hours.</p>
<div class="support-modal-btn text-right">
<button type="button" class="small-btn" data-dismiss="modal">Okay</button>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$("#form_support").submit(function(e) {
e.preventDefault();
});
</script>
<!--js -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js" type="text/javascript"></script>
<script src="js/jquery-3.4.1.min.js"></script>
<script src="js/popper.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/owl.carousel.min.js"></script>
<script src="js/select2.full.min.js"></script>
<script src="js/swiper-slider.js"></script>
<script src="js/jquery.mCustomScrollbar.js"></script>
<script src="js/bootstrap-datepicker.min.js"></script>
<script src="js/custom.js"></script>
</body>
</html>

Problem with sending html to a rich text box using Selenium and Python

I'm trying to send a very large html part into a rich text box, I've managed to send in part of the html code but the problem is that the links inside the html get opened whenever I send the code
This is what the html code that I'm trying to send looks like:
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600|Roboto+Condensed:300,400,700" rel="stylesheet" />
<link href="https://..." />
<link href="https://cldup.com/....css" rel="stylesheet" />
<link href="https://fonts.googleapis.com/css?family=Bree+Serif|Cairo|Saira+Semi+Condensed:400,700|Ubuntu" rel="stylesheet" />
<div class="wholeWidth">
<header>
<div class="containerWidth"><img alt="banner" src="https://..." /></div>
</header>
<div class="containerWidth">
<nav class="navbar navbar-default">
<div class="container text-center">
<div class="navbar-collapse" id="navbar">
<ul class="nav navbar-nav">
<li><a target="_blank" href="http://...">Geschäft</a></li>
<li><a target="_blank" href="https://...">NEUE ANKUNFT</a></li>
<li><a target="_blank" href="....</a></li>
<li><a target="_blank" href="....</a></li>
<li><a target="_blank" href="http://contact.ebay.de/ws/eBayISAPI.dll?FindAnswers&frm=284&requested=der_old_shatterhand&iid=-1">Kontakt</a></li>
</ul>
</div>
</div>
</nav>
</div>
<div class="containerWidth hidden-sm hidden-xs"><img alt="30days" class="img-responsive" src="https://..." /></div>
<div class="content">
<div class="listing_row1">
<div class="containerWidth">
<div class="row">
<div class="containerWidth"><img alt="banner" src="..." /></div>
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600|Roboto+Condensed:300,400,700" rel="stylesheet" />
<link href="https://..." rel="stylesheet" />
<link href="https://..." />
<link href="https://fonts.googleapis.com/css?family=Bree+Serif|Cairo|Saira+Semi+Condensed:400,700|Ubuntu" rel="stylesheet" />
<div class="wholeWidth">
<header>
<div class="containerWidth"><img alt="banner" src="https://..." /></div>
This is what the html that gets sent looks like, it also opened all of the links in the html:
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600|Roboto+Condensed:300,400,700" rel="stylesheet" />
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cldup.com/BIUxxmE1z4.css" rel="stylesheet" />
<link href="https://fonts.googleapis.com/css?family=Bree+Serif|Cairo|Saira+Semi+Condensed:400,700|Ubuntu" rel="stylesheet" />
<div class="wholeWidth">
<header>
<div class="containerWidth"><img alt="banner" src="https://cldup.com/00FhLi9aZS.png" /></div>
</header>
<div class="containerWidth">
<nav class="navbar navbar-default">
<div class="container text-center">
<div class="navbar-collapse" id="navbar">
<ul class="nav navbar-nav">
</ul>
</div>
</div>
</nav>
</div>
</div>
This is the python code I used to upload the html, is there any way to resolve this?
my_html = "html code"`
rich_text_box = driver.find_element_by_class_name("cke_source.cke_reset.cke_enable_context_menu.cke_editable.cke_editable_themed.cke_contents_ltr")
rich_text_box.clear()
rich_text_box.send_keys(my_html)
I also tried to execute a javascript in order to send the html, but it does not recognize "my_html".
iframe = driver.find_element_by_class_name("cke_wysiwyg_frame.cke_reset")
driver.switch_to.frame(iframe)
html_body = driver.find_element_by_css_selector('body')
driver.execute_script("arguments[0].innerHTML= my_html", html_body)
This is the error I get when I try to use javascript:
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.JavascriptException: Message: javascript error: my_html is not defined
(Session info: chrome=88.0.4324.182)
You have to send your html code through arguments[1] like this if you want to inject it as a script :
driver.execute_script("arguments[0].innerHTML= arguments[1]", html_body, my_html)

Google Apps Dad Joke Script - JSON parse error "Unexpected token: < "

I'm trying to pull a joke from the dad joke API using this GAS JSON guide yet am running into a parse error when I try to get a JSON object.
The error happens when I call JSON.parse(dadJokeText);
The first fix I've tried was publishing my app for public, anonymous use (may have been an auth issue), that didn't work.
Tried reformatting my code using this suggestion, still same error.
I do not have any experience using JSON, sorry that this is a dupe post, haven't had success trying to learn from the other questions.
Thanks in advance
function getJoke() {
var url = "https://icanhazdadjoke.com/";
var options = {
"contentType" : "application/json"
}
// make a GET request to the dad joke API
var dadJokeJSON = UrlFetchApp.fetch(url);
var dadJokeText = dadJokeJSON.getContentText();
var dadJokeObject = JSON.parse(dadJokeText);
var joke = dadJokeObject.value['joke'];
// log the joke that you retrieved
Logger.log(joke);
}
edit: this is the value of dadJokeText, looks like the HTML for the page
[18-12-10 12:06:11:690 EST] <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
<meta name="description" content="The largest collection of dad jokes on the internet" />
<meta name="author" content="C653 Labs" />
<meta name="keywords" content="dad,joke,funny,slack,alexa" />
<meta property="og:site_name" content="icanhazdadjoke" />
<meta property="og:title" content="icanhazdadjoke" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://icanhazdadjoke.com/j/7UnjNRfapzd" />
<meta property="og:description" content="Why should you never trust a pig with a secret? Because it's bound to squeal." />
<meta property="og:image:url" content="https://icanhazdadjoke.com/j/7UnjNRfapzd.png" />
<meta property="og:image:secure_url" content="https://icanhazdadjoke.com/j/7UnjNRfapzd.png" />
<meta property="og:image:secure_url" content="https://icanhazdadjoke.com/static/smile.png" />
<meta property="og:image:type" content="image/png" />
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="#icanhazdadjoke">
<meta name="twitter:title" content="icanhzdadjoke">
<meta name="twitter:description" content="Why should you never trust a pig with a secret? Because it's bound to squeal.">
<meta name="twitter:image" content="https://icanhazdadjoke.com/static/smile.png">
<meta name="twitter:url" content="https://icanhazdadjoke.com/j/7UnjNRfapzd" />
<link rel="canonical" href="https://icanhazdadjoke.com/j/7UnjNRfapzd">
<link rel="amphtml" href="https://icanhazdadjoke.com/j/7UnjNRfapzd/amp">
<title>icanhazdadjoke</title>
<link rel="apple-touch-icon" sizes="180x180" href="/static/apple-touch-icon.png">
<link rel="icon" type="image/png" href="/static/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="/static/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="/static/manifest.json">
<link rel="mask-icon" href="/static/safari-pinned-tab.svg" color="#1fc8db">
<link rel="shortcut icon" href="/static/favicon.ico">
<meta name="msapplication-config" content="/static/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
<link rel="stylesheet" href="/static/dist/style.css?55f4ea12">
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "WebSite",
"url": "https://icanhazdadjoke.com/",
"name": "icanhazdadjoke",
"description": "The largest collection of dad jokes on the internet",
"potentialAction": {
"#type": "SearchAction",
"target": "https://icanhazdadjoke.com/search?term={search_term_string}",
"query-input": "required name=search_term_string"
}
}
</script>
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "Organization",
"url": "https://icanhazdadjoke.com/",
"logo": "https://icanhazdadjoke.com/static/smile.png",
"name": "icanhazdadjoke",
"description": "The largest collection of dad jokes on the internet",
"email": "support#icanhazdadjoke.com"
}
</script>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({google_ad_client: "ca-pub-3200991035275362", enable_page_level_ads: true});
</script>
</head>
<body>
<nav class="nav has-shadow">
<div class="container">
<div class="nav-left">
<a class="nav-item is-brand" href="/">
<img src="/static/smile.svg" alt="icanhazdadjoke logo" />
<span class="subtitle pushhalf--left">
icanhazdadjoke
</span>
</a>
</div>
<span id="nav-toggle" class="nav-toggle">
<span></span>
<span></span>
<span></span>
</span>
<div id="nav-menu" class="nav-right nav-menu">
<a class="nav-item is-tab" href="/">
<span class="icon is-small">
<i class="fa fa-random"></i>
</span>
<span class="pushquarter--left">
Random joke
</span>
</a>
<a class="nav-item is-tab" href="/search">
<span class="icon is-small">
<i class="fa fa-search"></i>
</span>
<span class="pushquarter--left">
Search jokes
</span>
</a>
<a class="nav-item is-tab" href="/submit">
<span class="icon is-small">
<i class="fa fa-pencil-square-o"></i>
</span>
<span class="pushquarter--left">
Submit new joke
</span>
</a>
<div class="nav-item">
<a href="/slack-add" style="height:40px; max-width:139px">
<img alt="Add to Slack" height="40" width="139" src="https://platform.slack-edge.com/img/add_to_slack.png" style="width:139px; height:40px; max-height: 40px" srcset="https://platform.slack-edge.com/img/add_to_slack.png 1x, https://platform.slack-edge.com/img/add_to_slack#2x.png 2x" />
</a>
</div>
<div class="nav-item">
<a class="button" target="_blank" href="https://www.amazon.com/Brett-Langdon-icanhazdadjoke/dp/B01N6CQ3NZ/" style="background-color: #ffffff; color: #5ebfe4; border-radius: 6px; font-weight: 500; height:40px; width:139px; max-width:139px">
<img src="/static/alexa-logo.png" style="margin-left: -0.5em;">
Add to <strong style="margin-left: 0.25em">Alexa</strong>
</a>
</div>
</div>
</div>
</nav>
<section class="section">
<div class="container">
<div class="level">
<div class="level-left">
<div class="content level-item">
<h1>Random dad joke:</h1>
</div>
</div>
<div class="level-right">
<a class="button is-primary level-item" href="/">
<span class="icon is-small">
<i class="fa fa-random"></i>
</span>
<span>
New joke
</span>
</a>
</div>
</div>
<div class="content">
<div class="card">
<div class="card-content">
<p class="subtitle">Why should you never trust a pig with a secret? Because it's bound to squeal.</p>
</div>
<footer class="card-footer">
<a class="card-footer-item" href="/j/7UnjNRfapzd">
<span class="icon is-small">
<i class="fa fa-chain"></i>
</span>
<span class="pushquarter--left">
Permalink
</span>
</a>
<a class="card-footer-item" target="_blank" href="https://twitter.com/intent/tweet?url=https://icanhazdadjoke.com%2Fj%2F7UnjNRfapzd%2Famp&text=Check+out+this+%23dadjoke&via=icanhazdadjoke">
<span class="icon is-small">
<i class="fa fa-twitter"></i>
</span>
<span class="pushquarter--left">
Share on Twitter
</span>
</a>
</footer>
</div>
</div>
<div class="content pushwhole--top">
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-3200991035275362" data-ad-slot="5324903139" data-ad-format="auto"></ins>
</div>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
</section>
<footer class="footer">
<div class="container">
<div class="columns">
<div class="column is-5">
<div class="content">
<p>
<strong>icanhazdadjoke.com</strong> by C653 Labs.
</p>
<p>
<i>icanhazdadjoke.com</i> is the largest selection of dad jokes on the internet.
Now supporting many different integrations to ensure you can access the dad jokes that you need wherever you are.
</p>
</div>
</div>
<div class="column is-3"></div>
<div class="column is-2">
<aside class="menu">
<ul class="menu-list">
<li>Contact</li>
<li>Twitter</li>
<li>Slack app</li>
<li>Alexa skill</li>
<li>Discord bot</li>
<li>HipChat plugin</li>
<li>Twist integration</li>
</ul>
</aside>
</div>
<div class="column is-2">
<aside class="menu">
<ul class="menu-list">
<li>About</li>
<li>API</li>
<li>Random joke</li>
<li>Search jokes</li>
<li>Submit new joke</li>
</ul>
<
Nowhere in your "fetch" call do you set the "Accept" header to "application/json" as required by the API in order to get the response formatted as JSON.
You do set a variable called options in your code, but as far as I can see you never use it for anything. And in any case it sets the wrong header - needs to be "Accept", not "ContentType" - actually it should be "Content-Type" to be correct, but even then, Content type tells the server what type of data you are sending, not what kind you would like back in return.
I would expect you need to make your request like this:
var url = "https://icanhazdadjoke.com/";
var options = {
method: 'GET',
headers: {
"Accept" : "application/json"
}
};
// make a GET request to the dad joke API
var dadJokeJSON = UrlFetchApp.fetch(url, options);
See https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch for documentation on the Fetch API in JavaScript

SideBar No display in Ipad

Good Day,
Question I have already try to apply all the fixes for Ipad to get the menu working, Like onclick="" and cursor: pointer;, I already check that the Jquery is working by putting: $(document).ready(function(){alert("We accessed the Javascript"); }); It works in every device, but in Ipad does not work at all, does not recognise the click and does not change the style class either.
I use as blueprint this example, then I customise it, so it has not been change that much.
SlideMenu
Here is the big code, sorry :S:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
class="no-js">
<f:view contentType="text/html">
<h:head>
<f:facet name="first">
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge; IE=11; IE=10; IE=9; IE=8; IE=7, chrome=1"/>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"/>
<title>BBVA</title>
<!-- BOOTSTRAP STYLES-->
<link href="${request.contextPath}/assets/css/bootstrap.css" rel="stylesheet" media="all" />
<!-- BBVA fonts -->
<link href="${request.contextPath}/assets/css/style2.css" rel="stylesheet" media="all" />
<!--SCRIPTS-->
<!---Apple Safari iPad and iPhone Meta Tags-->
<meta name="viewport" content="width=device-width"/>
<meta name="viewport" content="initial-scale=1.0"/>
<meta name="viewport" content="width=992, initial-scale=1, user-scalable=no"/><!--width is pixels, range 200 to 10000-->
<meta name="format-detection" content="telephone=no"/> <!--disables automatic detection of possible phone numbers-->
<meta name="apple-mobile-web-app-capable" content="yes"/><!--specifies full-screen mode-->
<meta name="apple-mobile-web-app-status-bar-style" content="black"/><!--specify full-screen mode first-->
</f:facet>
<!-- Custom BBVA Theme create by: Alejandro Daza -->
<link href="${request.contextPath}/assets/css/style.css" rel="stylesheet" media="all" />
<script src="${request.contextPath}/assets/js/bootstrap.min.js"></script>
<script src="${request.contextPath}/assets/js/modernizr.custom.js"></script>
<script src="${request.contextPath}/assets/js/style1.js"></script>
<script src="http://192.168.0.3:1337/vorlon.js"></script>
<script src="${request.contextPath}/assets/js/classie.js"></script>
</h:head>
<h:body>
<script>
$(document).ready(function(){
//Check if the current URL contains '#'
if(document.URL.indexOf("#")==-1){
// Set the URL to whatever it was plus "#".
url = document.URL+"#";
location = "#";
//Reload the page
location.reload(true);
}
});
</script>
<div class="container pagina">
<div class="col-md-1 col-lg-1 menu2">
<div class="col-md-4 information nopaddingleft nopaddingright">
<ul class="information_menu">
<li class="active" data-id="1"><i class="icon-home_icon"></i></li>
<li data-id="2"><a id="showmenu1" onclick="" ><i class="icon-menu_icon"></i></a></li>
<div class="spacing"></div>
<li data-id="3"><i class="icon-settings_icon"></i></li>
<li data-id="4"><i class="icon-help_icon"><span class="path1"></span><span class="path2"></span><span class="path3"></span><span class="path4"></span><span class="path5"></span></i></li>
</ul>
</div>
<!-- Sidebar -->
<div class="menunivel1 menunivelleft1" id="menunivel1">
<ul class="information_menunivel1">
<li class="active" data-id="1"><a href="#">
<img src="../assets/img/perfil.png" style=" width: 35%; position: absolute; left: 13px;top: 13px;" />
<ul class="menuPerfil">
<li>
Luci Santodomingo
</li>
<li>
Gerente
</li>
<li>
Oficina Calle 123
</li>
<li>
Bogotá
</li>
</ul>
</a></li>
<li><a id="showmenu2" href="#" onclick="" ><p>Gestion comercial <span class="icon-forward_icon flechas"></span></p></a></li>
<li><p>Cartera de clientes <span class="icon-forward_icon flechas"></span></p></li>
<li><p>Oportunidades comerciales <span class="icon-forward_icon flechas"></span> </p></li>
<li><p>Portal de desarrollo comercial <span class="icon-forward_icon flechas"></span> </p></li>
<li><p>Portal MIS <span class="icon-forward_icon flechas"></span></p></li>
<li><p>Alerta de fuga</p></li>
</ul>
<!-- Sidebar -->
<div class="menunivel2 menunivelleft2" id="menunivel2">
<ul class="information_menunivel2">
<li class="active">
<a href="#">
<ul class="menuPerfil">
</ul>
</a>
</li>
<li ><a id="showmenu3" href="#" onclick=""><p>Citas para hoy <span class="icon-forward_icon flechas"></span></p></a></li>
<li><p>Agenda <span class="icon-forward_icon flechas"></span> </p></li>
<li data-id="4"><p>Reclamos <span class="icon-forward_icon flechas"></span> </p></li>
</ul>
<!-- Sidebar -->
<div class="menunivel3 menunivelleft3" id="menunivel3">
<ul class="information_menunivel3">
<li class="active" data-id="1">
<a href="#">
<ul class="menuPerfil">
</ul>
</a>
</li>
<li><p>Propia</p></li>
<li><p>Mis Ejecutivos </p></li>
</ul>
</div>
</div>
</div>
</div>
<!-- Page Content -->
<div class="col-md-11 col-lg-11 contenedorderecha clearfix">
<div class="row contenedorModulos clearfix">
<h:form id="principalForm">
<ui:insert name="content"/>
</h:form>
</div>
</div>
</div>
<script>
//<![CDATA[
var menunivel1 = document.getElementById('menunivel1'),
menunivel2 = document.getElementById('menunivel2'),
menunivel3 = document.getElementById('menunivel3');
$("#showmenu1").click(function(){
classie.toggle(this, 'active');
classie.toggle(menunivel1, 'menu1open');
});
$("#showmenu2").click(function(){
classie.toggle(this, 'active');
classie.toggle(menunivel2, 'menu2open');
});
$("#showmenu3").click(function(){
classie.toggle(this, 'active');
classie.toggle(menunivel3, 'menu3open');
});
//]]>
</script>
</h:body>
</f:view>
</html>
As you can see I am using xhtml, I dont know if that is related with the issue, or if is any primefaces query that is interfering with the on file jquery.
I have been with this issue for more than 2 weeks, I have the webpage on a local server, for security reason I will provide you with the link by chat or email If you want to take a complete look at it.
sorry, my english is not that great.
Some jquery functions in the web will not work the same way in IPAD or any other device.
Try this
$('selector').on('click touchstart', function() {
});
$("#showmenu1").on('click touchstart', function(){
classie.toggle(this, 'active');
classie.toggle(menunivel1, 'menu1open');
});

Categories